The bomber struck as some 300 people, including top police officers of Balochistan province, were attending the funeral of police station chief Mohib Ullah, who was gunned down Thursday morning.
Senior police officials said 38 were killed and 50 others, mostly policemen, injured. Deputy Inspector General of Police Fayyaz Sumbol, Superintendent of Police Ali Mahar and Deputy Superintendent of Police Shams'ur-Rehman were among the dead.
The banned Tehrik-e-Taliban Pakistan claimed responsibility for the attack. Militant spokesman Shahidullah Shahid told reporters on phone that his group would continue attacking police and other security personnel.
The attacker detonated his explosive vest when he was stopped by guards at the gate of a mosque within the Police Lines in Quetta, the capital of Balochistan.
"It was a suicide attack and the attacker blew himself up at the entrance where he was intercepted by policemen on duty," city police chief Mir Zubair Mehmood said.
Balochistan police chief Mushtaq Sukhera said 30 policemen died in the attack. Despite such incidents, police would continue fighting the militants, he said.
"It is a major attack on police and at least eight kilos of explosives were used in the suicide attack," Mehmood said.
The provincial police chief and city police chief had a narrow escape. The bomber carried out the strike despite extensive security arrangements within the Police Lines.
The victims were taken to a military hospital due to fears that civilian hospitals might be attacked. After a recent bombing at a women's university in Quetta, militants attacked the hospital where the injured were taken.
Earlier in the day, police station chief Mohib Ullah was killed and his four children and a driver were injured when unidentified gunmen attacked his car at Alamu Chowk in Quetta.
Mohib Ullah was going to the market with his children when he was attacked.