ISIS terrorist group claimed responsibility for the attack that took place when many Muslim worshipers had gathered at the mosque for Friday prayers.
Mohammad Salim Rasouli, chief of Kabul's hospitals, said at least 50 other people, including many children, were injured.
An official at Afghanistan’s Interior Ministry earlier said at least eight policemen had been wounded.
The ministry confirmed that the incident was a "terrorist attack,” with deputy spokesman Najib Danish saying that the bomber had detonated himself while two or three other militants had entered the mosque and were exchanging fire with policemen.
Witnesses said that gunmen threw grenades and then entered the mosque.
"The bombers are running short of bullet rounds and they are using knives to stab worshippers," an eyewitness told AFP.
Meanwhile, Mir Hussain Nasiri, a member of Afghanistan's Shia clerical council, said the cleric who was performing the prayers was killed.
The gunmen have taken over the portion of the mosque with the separate prayer areas for men and women, he added.
Daesh has attacked Shia Muslim targets in Afghanistan in the past. Last month, 32 people were killed when Daesh militants stormed a Shia mosque in western province of Herat.
Afghanistan has been torn by decades of Taliban-led militancy and the 2001 invasion of the US and its allies. Daesh has also emerged there more recently.
Earlier this week, US President Donald Trump unveiled his administration’s new strategy in Afghanistan, saying he would prolong the military intervention in the Asian country and rejected what he called “arbitrary timetables” for the withdrawal of US troops.