The first explosion tore through a Shia mosque in the city of Mazar-i-Sharif.
At least 31 people were killed, and 87 were wounded, the BBC has been told.
The Islamic State group (IS) admitted carrying out the attack. The Taliban say they have defeated the IS but the group remains a serious security challenge to Afghanistan's new rulers.
The attack on the Mazar-i-Sharif mosque was carried out using a remotely detonated booby-trapped bag when the building was packed with worshippers, the IS jihadists said.