It was the second day of fighting in Shahukhel in Hangu district close to the Afghan border.
Like other parts of the lawless frontier zone, Hangu is home to Al Qaeda and Taliban insurgents that launch attacks in Pakistan, as well as in Afghanistan.
Pakistan is under pressure to crack down on militants and has won praise from its Western allies for an ongoing, major operation in the South Waziristan border region. But critics say the army should do more against insurgent groups who use the northwest as a safe haven to attack Western troops in Afghanistan.
Hangu is around 93 miles north of South Waziristan.
In Shahukhel, troops backed by artillery and helicopters killed 18 militants on Monday, intelligence officials said on customary condition of anonymity. There was no word on any military casualties. On Sunday, 12 militants were killed in the same area.
Journalists are banned from visiting the border region, making it impossible to verify casualty figures.
Taliban militants have carried out, or been blamed for, hundreds of bloody bombings in Pakistan against Western, military and government targets in recent years, including a spike over the last seven weeks that has killed more than 300 people.