Eyewitness video from the blast site showed several injured people being carried away from the scene. The mosque is used by people from the minority Shi'ite Muslim community.
No group immediately claimed responsibility. The blast followed several attacks, including one at a mosque in Kabul, in recent weeks, some of which have been claimed by the Sunni Muslim militants of Islamic State.
One Taliban official, speaking on condition of anonymity, said at least 28 people had been killed and dozens more wounded in Friday's blast.