Police official Mohammed Sadique Muradi said two of the attackers blew themselves up and another two were shot by Afghan Security Forces.
In the claim, IS says two of its fighters, seeking martyrdom, carried out the assault.
An unidentified police official quoted witnesses as reporting a blast followed by gunfire.
Shiites, a minority of about three million in overwhelmingly Sunni Afghanistan, have been targeted regularly by ISIL.
"The bombers are running short of bullet rounds and they are using knives to stab worshippers", another eyewitness said.
Meanwhile, four soldiers were killed and several policemen injured when Taliban attacked a security outpost in southern Kandahar province on Friday morning.
Heavily armed security forces stormed the building and rescued more than 100 worshippers, according to the interior ministry, which had initially put the death toll at 12, including 10 civilians and two security force personnel. While he did not give specifics, senior USA officials have said that he might send up to 3,900 more troops, with some deployments beginning nearly immediately.
The attack took place in Imam Zaman Shaia Mosque in the Qala-i-Najaran locality of the city. There was no immediate comment from the Taliban.
It comes just one day after the top USA military commander in the country vowed to crush the Islamic State militant group (ISIS) and urged the Taliban to join peace talks.