The bomber detonated his explosives as Hilal Hyder's vehicle was passing through a crowded market in the city of Peshawar, said police officer Asif Iqbal.
Hyder, who was investigating cases against militants in the troubled northwest, was killed along with two of his guards and two bystanders, said Iqbal. At least 37 other people were wounded.
Pakistani Taliban spokesman Ahsanullah Ahsan claimed responsibility for the attack, saying Hyder was working against the militant group.
"We killed him today in Peshawar because he was behind the arrest of some of our fighters," Ahsan told The Associated Press by telephone from an undisclosed location.
The Pakistani Taliban have been waging a bloody insurgency for the past several years because they oppose the Pakistani government's alliance with the United States and want to enforce Islamic law throughout the country.
Peshawar has experienced many attacks because it is located on the edge of Pakistan's tribal region, the main sanctuary for militants in the country.