Taliban spokesman Zabiullah Mujahid took responsibility for the attack and said Abdul Jabar, one of the group's fighters, targeted the spy chief while he and several others were leaving a mosque.
Mujahid said 10 other government officials, including the head of the provincial council, were also killed in the attack.
The attack was a major blow to the National Directorate of Security (NDS), the country's intelligence service, which has recently claimed to have foiled dozens of attempts by Taliban militants, who were trying to attack government and foreign forces' targets.
Taliban insurgents have targeted several Afghan officials in the past, including a brazen attack in May 2008 in which several Taliban gunmen opened fire on President Hamid Karzai during a military parade. Karzai was unharmed, but a member of parliament and two others were killed in the attack.