The bombing, the latest in a wave of killings claimed by the militant Sunni group, came hours after the Red Cross said a gunman killed two of its Yemeni employees in the war-torn country's rebel-held north in a "deliberate" attack.
IS said a man identified as Qusai al-Sanaani blew himself up after sunset prayers inside the Al-Muayad mosque in the northern Jarraf district, home to many senior figures from the Shiite Huthi rebels that control Sanaa.
The militants said a bomb-laden vehicle parked nearby also exploded as medics arrived on the scene, bringing the death toll to at least 28 people and wounding some 75 more, according to medical officials.
An AFP reporter heard two loud explosions followed by many sirens as ambulances rushed to the scene.
Body parts were blown several metres (yards) away from the scene and nearby buildings were damaged, witnesses said, adding that Huthi gunmen were deployed after the attack to set up new checkpoints across the capital.
The attack was to "avenge Muslims against the Rafidah (Shiites)," IS said in a statement on Twitter.
Its account was confirmed by sabanews.net, the website of the Iran-backed Shiite Huthi rebels that control Sanaa.
Radical Sunni Muslim group IS considers Shiites to be heretics and has claimed similar bombings of other Shiite mosques in Sanaa as well as in Kuwait and Saudi Arabia.
Sunni power Saudi Arabia is leading a coalition that has been bombing the Iran-backed Huthis, which has driven the rebels out of Yemen's second city Aden and four other southern provinces and is now fighting for control of the third city of Taez.
US President Barack Obama is expected to raise the campaign at the first, long-delayed White House summit with Saudi Arabia's King Salman on Friday, particularly concerns over the impact the bombing has had on civilians.