The incident occurred late yesterday in Landikotal area of Khyber tribal agency.
"Two soldiers embraced shahadat (martyrdom) and three others injured this evening in an exchange of fire with terrorists in Landikotal, Khyber," The Dawn said.
Three soldiers were also injured, according to the security official.
Yesterday was a deadly day for forces as six soldiers and a civilian were killed in three separate bombings in Pakistan, including twin blasts in the heavily guarded capital.
The soldiers were killed in Mohmand agency which borders Khyber.