Special forces commandos stormed the building just before 6 a.m., The New York Times reported. Major Gen. Athar Abbas said they rescued hostages being held by the militants and took the only surviving attacker prisoner.
The raid ended a standoff that began Saturday morning when a van with military plates carrying heavily armed men in military uniforms arrived at headquarters. A firefight began at a checkpoint, and six Pakistani soldiers and four of the militants were killed.
The survivors ran into a building and took hostages, Abbas said. The hostages were described as a mix of military men and civilians.
The attack is one of a series that included a bomb that killed 48 people in a Peshawar market on Friday and the bombing of a U.N. World Food Program office Monday in Islamabad.
The government said the attacks would not stop a planned offensive against the Taliban in Waziristan.
"I want to give a message to the Taliban that what we did with you in Swat, we will do the same to you there, too," Interior Minister Rehman Malik said, referring to the operation in the Swat Valley during the summer.