The attack targeted Shia worshipers who had gathered at the mosque to mark the end of a 40-day mourning period for the death of Imam Hussein, the grandson of the Prophet Muhammad.
More than 30 people were killed and dozens wounded in a suicide attack on a crowded mosque in Kabul on Monday.
Daesh claimed responsibility for the attack that targeted a Shia gathering at Baqir-ul-Olum mosque.
The worshippers had gathered for Arbaeen, which marks the end of a 40-day mourning period for the 7th century death of Imam Hussein, the grandson of the Prophet Muhammad.
Fraidoon Obaidi, chief of the Kabul police Criminal Investigation Department, said at least 27 people were killed and 35 wounded. Other sources put the death at over 30.
"I saw people screaming and covered in blood," one survivor told Afghanistan's Ariana Television, adding that around 80 people were injured in the attack that left a large crater inside the two-storey mosque.
According to local officials, the death toll could rise sharply as most of those injured were in serious condition.
Daesh, based mainly in the eastern state of Nangarhar on the border with Pakistan, has gradually expanded its reach since emerging in Afghanistan last year.
Prior to Monday's attack, it had claimed responsibility for two major attacks in Kabul, including a suicide bombing which killed more than 80 people at a demonstration by the mainly Shia Hazara community. It was the worst single attack on civilians since 2001.