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 terrorists 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.
Several banned organisations, including the Taliban, are active in Khyber Agency and the army recently launched an operation in the region to flush out militants who had captured strategic heights.
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 terrorists but they have still not been defeated and use the lawless tribal region to train recruits and launch attacks.
3 killed as militants attack NATO trucks in Pak
Pakistan army denies cross-LoC firing
Pak intruder killed in IED blast along LoC in Poonch
Pak's first sect-free mosque calls for end to discrimination
Pak forms panel to probe high treason case against Musharraf