The incident occurred yesterday when firing hit soldiers in Angor Adda area of South Waziristan, one of seven tribal region along Afghan border.
Security sources said the firing from Birmal area in Paktika province of Afghanistan targeted a Pakistani outpost.
"Two security personnel were killed and another injured," sources said.
They were part of 56-Punjab Regiment stationed in the area to fight militants.
No group claimed responsibility of the attack.
Militants fled across the border to Afghanistan after operations by Pakistani security forces.