A suicide car bomber killed two people and wounded 40 others, including women and children, outside a security training centre in Wardak province west of Kabul, police said.
Taliban insurgents claimed responsibility for the attack, saying it was to avenge the execution on Wednesday of four Taliban members on death row in Kabul.
"It was a car bomb by our mujahed on a military training centre," Taliban spokesman Zabihullah Mujahid told AFP.
"It was a revenge attack by our mujahid in response to the execution of four mujahedeen by the Kabul administration."
Police said the explosion took place near a police centre in Maidan Shar, the capital of Wardak province. The premises is used to train Afghan soldiers and police.
"As a result two civilians were killed and 40 others were injured," police spokesman Abdul Wali told AFP.
The four executed Taliban members were among a total of 14 prisoners hanged over two days this week in rare mass executions.
The Taliban, who are leading an insurgency against the Western-backed government, had warned there would be "heavy repercussions" for government officials if any of their militants were executed.
President Hamid Karzai approved the executions of the men who were sentenced to death "on charges of terror, conducting attacks, explosions and organising suicide attacks", a government spokesman said in a statement.
The mass executions were condemned by the United Nations, the European Union and human rights groups.