A suicide bomber rammed a water tanker into a Pakistani check post late Saturday, killing 17 soldiers in the tribal district of North Waziristan, the military said.
There was no immediate claim of responsibility for the attack.
The deaths were a reminder of the serious security threat in Pakistan, just hours before former military ruler Pervez Musharraf was due to return home to the southern city of Karachi after more than four years in exile.
"In last night's attack on a security forces' checkpost in North Waziristan, 17 security forces personnel embraced shahadat (martyrdom)," the military said.
Security officials explained the sudden increase in the death toll after it jumped from six by saying that many of the dead had been trapped under the rubble following the blast.
Another 10 soldiers were also wounded in the attack on a check post operated jointly by the regular army and the Frontier Corps paramilitary.
Pakistani troops have fought for years against homegrown insurgents in the tribal belt on the Afghan border.
There are fears that rampant insecurity could prove a major challenge for historic general elections on May 11, which should mark the first democratic transition of power between two civilian governments in Pakistani history.