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-Qaida 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 about 93 miles (150 kilometers) 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.
Police officer Farid Khan said security forces, including police, had captured much of the area since Sunday.
There was no word on any military casualties. On Sunday, 12 militants were killed in the same area, officials said.
To the north, a mortar shell fired against a Pakistani base in the Khyber border area of Landi Kotal missed its target but struck a passenger bus, killing six civilians and wounding 16, government official Fazal Mahmoud said.
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.
Associated Press writer Riaz Khan in Peshawar contributed to this report.