The ambush, which occured at a security outpost in Mohmand, saw dozens of fighters armed with automatic weapons and rocket launchers attack forces, local officials said.
The army responded by shelling militant positions there, killing 10 suspected fighters, intelligence officials told the AP news agency.
Mohmand lies some 200km north of South Waziristan, where the army is undertaking a major offensive against the Taliban.
The district has been the scene of sporadic army offensives over the last year, but the latest violence could be a sign that violence is spreading away from the main frontlines.
Wednesday's attacks come a day after at least 26 people died in a suicide car bombing in a crowded market in northwest Pakistan.
General Ashfaq Kayani, Pakistan's army chief, described the attacks on civilians as "cowardice and frustration".
"Since terrorists were incapable of confronting the military operation, they were targeting innocent civilians," he said in a statement.
But Taliban spokesman Azam Tariq told AFP on Tuesday that attacks on cities were part of a strategy.
The militia has embarked on a guerrilla war from the mountains of South Waziristan, he said, pledging: "We will prove that we can fight for years."
Some 502 Taliban fighters have reportedly been killed since the battle against an estimated 10,000 Islamists began on October 17.
The army says 46 soldiers have been killed.