The fighting took place during an intelligence-based operation in the country's South Waziristan region
A gun battle left seven soldiers and five militants dead in Pakistan's restive north-western tribal areas bordering Afghanistan, the military said on Wednesday.
The fighting took place during an intelligence-based operation in the country's South Waziristan region, the site of several military operations and US drone strikes targeting homegrown and foreign militants.
"An intense exchange of fire killed five terrorists while seven soldiers embraced martyrdom," the military said in a statement.
"Cordon and search operation still continues to eliminate any other terrorists found in the areas."
The military did not specify the date and time of the incident.
But a spokesman for the Tehreek-e-Taliban Pakistan militant group claimed the fighting took place on Tuesday.
"Our Mujahideen fought bravely with Pakistan army's soldiers on Tuesday night and killed nine of them," Muhammad Khurasani said in a statement.
The army has waged multiple large-scale offensives against Pakistani Taliban and other militant strongholds in North and South Waziristan over the past 15 years.
Security in Pakistan has improved dramatically over the past few years but militant groups still operate along the border with Afghanistan.