The fighting started last night when army and paramilitary forces launched an operation in Zao Kharamtang area of Khyber Agency, one of seven tribal districts where al-Qaeda-linked militants are active.
State-run Radio Pakistan reported that 22 militants and six soldiers had died in the fighting.
Another six soldiers were injured and shifted to hospital.
A military official confirmed the offensive and casualties on both sides.
He said the militants were helped by local criminals involved in kidnapping, drug trafficking and gun-running.
In April, the military launched a major operation in the Tirah valley area along the Afghan border and claimed to have recaptured strategic heights after weeks of fighting.
The Pakistan Army regularly launches offensives against the militants but they have still not been defeated and use the lawless tribal region to train recruits and launch attacks.