The attack late on Thursday occurred near the town of Wana in South Waziristan province, where Pakistani security forces had launched an operation against "foreign terrorists".
A local official said four soldiers were killed and at least three were wounded when unidentified attackers fired rockets at their camp.
Military spokesman Major General Shaukat Sultan said only one or two soldiers were killed, while two were wounded.
"The attackers fired a couple of rockets at the camp near Wana," he said. "Unfortunately there were one or two casualties."
Witnesses in Wana, the capital of South Waziristan, said they had heard firing for about 45 minutes.
Pakistan's rugged mountain region bordering Afghanistan is thought to be a haven for al-Qaida and Taliban fugitives because they enjoy massive support among the local Pashtun population.
The military's operation ended on Friday without any terror suspects being found.
"The army search which was backed by helicopters has concluded and no foreign suspects have been found"
Maj Gen Shaukat Sultan
"The army search which was backed by helicopters has concluded and no foreign suspects have been found," Sultan said.
Local officials said helicopter gunships had fired at five houses during the operation when troops came under fire.
Three houses were damaged in the aerial action but there were no casualties.
During the offensive launched on Thursday, the troops searched Kalu Shah village near Wana, around 40km from the Afghan border.
Sultan said the search operation was launched after a few locals were taken in for questioning in connection with intelligence reports about the presence of foreign terrorists in the area.
Last year, the Pakistani military carried out two major operations in South Waziristan, which borders Paktika province in eastern Afghanistan.
In the latest of the two in early October, eight al-Qaida suspects and two soldiers were killed and 18 suspects arrested.
South Waziristan has long been a suspected sanctuary for al-Qaida and resurgent Taliban fighters fleeing US-led forces in Afghanistan.
Despite Pakistan's crackdown that led to the arrest of hundreds of al-Qaida suspects since the November 2001 fall of the Taliban regime, Afghan and US officials have continued
to express concern over regrouping of the rebels in tribal areas across the border.
Pakistan has dismissed the allegations and urged the Afghan government to improve the situation on their side and increase intelligence coordination in the counter terrorism campaign.