An official of the military's media wing said the 10 soldiers had been missing in Orakzai district since December 21 when rebels attacked a check-post and killed 13 others.
One security official said the 23 soldiers were attacked in a late-night assault by up to 100 heavily armed insurgents.
Another security official said the 10 soldiers had been beheaded and their bodies recovered in an exchange with the Taliban.
"They handed over the beheaded bodies of 10 officials while we handed over four bodies of militants to them," the official said.
Exchange of bodies
The Pakistani Taliban claimed responsibility but said 10 of their men had been killed.
"We killed these soldiers during the clash. They had the bodies of our 10 people and we had in our custody the bodies of soldiers and the exchange of bodies took place today," said Tehreek-e-Taliban Pakistan (TTP) spokesperson Ehsanullah Ehsan.
The exchange comes four days after the corpses of 15 members of Pakistan's paramilitary Frontier Constabulary (FC) were found in the small northwestern town of Shawa, in North Waziristan tribal region near the Afghan border, almost two weeks after they were kidnapped.
The Tehreek-e-Taliban Pakistan claimed responsibility for those killings.
The FC personnel were kidnapped late last month during a night-time attack on a checkpoint in the northwestern town of Tank.
Pakistan's seven tribal districts near the Afghan border, including North Waziristan, are rife with homegrown insurgents and are strongholds of Taliban and Al-Qaeda operatives.
Islamist militants opposed to the government, particularly the nebulous TTP network, have carried out bomb and gun attacks killing more than 4 700 people across Pakistan since July 2007.
3 000+ soldiers killed
But significantly, there has been no major Islamist militant attack in Pakistan since a suicide bomber killed 46 people, targeting anti-Taliban militia at a funeral in the northwestern district of Lower Dir on September 15.
Pakistan has for years battled insurgents in the northwest and the tribal belt, with more than 3 000 soldiers killed in the battle against militancy.
Pakistan's tribal regions are rife with militancy, especially in North Waziristan, a bastion of the Afghan Taliban-allied Haqqani network, blamed for some of the worst attacks in Afghanistan.
A Nato air strike on the border that killed 24 Pakistani soldiers on November 26 seriously eroded a fragile alliance between the United States and Pakistan, with Islamabad calling it a deliberate attack.
Pakistan refused to take part in a Nato inquiry into the incident, having criticised previous investigations into cross-border attacks as worthless. Instead, it has sought a formal apology from US President Barack Obama.
Islamabad has kept its Afghan border closed to Nato convoys since November 26, boycotted the Bonn conference on Afghanistan and ordered Americans to leave an air base understood to have been a hub for CIA drone strikes on the Taliban.