A bomb detonated in a car left a breach in the perimeter wall of a military compound in Quetta, Pakistan, allowing a suicide bomber to enter on foot and detonate his device.
At least 24 people are dead, many of them soldiers from a unit that helped arrest a senior Taliban figure in the town two weeks ago.
The Pakistani Taliban says it carried out the attack, in revenge for the arrest of Younis al-Mauritani.
He is suspected of involvement in al Qaeda attacks in Europe, the US and Australia.
The local hospital has been overwhelmed with casualties from the blast.
A total of 61 people were wounded, many of them seriously.