Over 70 militants tried to enter the border areas of Killa Saifullah Khan district, resulting in the gunbattle with the Frontier Corps (FC) soldiers posted along the border with Afghanistan.
FC spokesman Khan Wasseh said the militants were pushed back but one Pakistani soldier was killed in the exchange of fire. He also claimed that several intruders were injured.
Taliban militants from Afghanistan often intrude into Pakistani territory in the northwest and attack military check posts, souring diplomatic ties between the two countries.
Earlier this month, militants from Afghanistan attacked the house of a local anti-Taliban militia member in northwestern Upper Dir district, killing him and three members of his family.
Pakistan blames Tehreek-e-Taliban Pakistan (TTP) chief Mullah Fazlullah, believed to be hiding somewhere in Afghanistan's Nuristan province, for the attacks.