Islamic State immediately claimed responsibility for the attack in the capital Kabul, which also left 119 people injured.
Police said the suicide bomber targeted civilians who had gathered to receive national identification cards.
Windows in buildings miles away were shattered by the huge explosion which echoed across the city.
Police closed all roads around the site of the blast allowing only ambulances to pass.
TV stations broadcast live footage of hundreds of distraught people gathered at nearby hospitals seeking news about loved ones.