Pakistani paramilitary forces killed 34 Taliban fighters in clashes in the restive tribal region on the Afghan border, the military said.
At least three soldiers were also killed in the battle in the Malik din Khel area of the Khyber district on Thursday.
"Militants attacked Frontier Corps soldiers while they were carrying out search operation in the area," the military said in a statement. "Security forces responded effectively."
The death toll was announced shortly before Hillary Clinton, the US secretary of state, was expected in Pakistan for crunch talks aimed at ramping up pressure on Islamabad to do more to eliminate Taliban safehavens on the Afghan border.
The fighting erupted when Pakistan's paramilitary Frontier Corps launched a search operation in the Malik din Khel area.
The strategically important Khyber district lies between Peshawar and Afghanistan and is the main route for NATO supplies in Afghanistan.
Mutahir Zeb, the top administrative official of Khyber, said fighters from Lashkar-e-Islam (army of Islam) were involved.
"At least 34 militants and three soldiers were killed during an encounter," a Frontier Corps statement said.
There was no immediate independent confirmation of the death toll as the area is off-limits to journalists and aid workers.
"Security forces responded effectively and have cleared the area of militants," it said. Zeb had said earlier that four soldiers had been killed.
Lashkar-e-Islam is the most active group in Khyber and led by feared warlord Mangal Bagh. It has loose ideological ties to the Taliban, but operates independently.
Nearly 4,700 people have been killed across Pakistan in attacks blamed on Taliban and al-Qaeda-linked fighers based in the northwestern tribal belt since government troops stormed a radical mosque in Islamabad in 2007.
Around 3,000 Pakistani soldiers have also lost their lives in attacks since 2001, when the country joined the "war on terror".