The football supporters had gathered in the predominantly Shia city of Balad on Thursday evening to see in the weekend.
The president of the local Real Madrid group said members meet at the al-Furat Cafe regularly, watching old matches featuring the Spanish team when no live games are on.
"A group of Islamic terrorists, from Isis, came into the café armed with AK-47s, shooting at random at everyone who was inside,” Ziad Subhan told the Diario AS newspaper.
"They don't like football, they think it's anti-Muslim. They just carry out attacks like this. This is a terrible tragedy.”
Police said three gunmen opened fire with machine guns at around midnight, killing more than a dozen people and wounding 25 others.
There were conflicting reports on possible suicide bombers, with Isis claiming three “martyrs” killed themselves but police saying only one or possibly two had died.
Photos of the scene showed pools of blood covering the floor and sofas burned and riddled with bullets, beneath posters of Real Madrid manager Zinedine Zidane and the Champions League trophy.
It was unclear whether football was the main motive for the attack but it was not the first time Isis has targeted supporters of the sport.
A suicide attack on a football match in the city of Iskandariya left at least 32 dead in March, with the bomber blowing himself up as a trophy was being handed to the winners.
A 22-year-old victim named Tahseen told a doctor he saw a man wearing civilian clothes and ammunition belt cross the street towards the café before hearing several blasts and gunfire lasting for around 10 minutes.
The assailants fled but several hours later, one of them blew himself up at a nearby vegetable market after police and Shia militia members cornered him in a disused building.
Medical officials said four people were killed and two critically wounded in the ensuing gun battle.
Another suspected attacker was seized from a nearby house and lynched by local residents, who said they had traced him from the café massacre.
The residents said they burned him alive after he confessed. A Reuters witness saw the scorched body hanging upside down from a post outside the café on Friday morning.
Fighters from the Iranian-backed Badr Organisation also raided a nearby house and detained 13 members of a Sunni family as security forces were deployed to restore order in the city, security officials said.
Isis almost overran Balad, 50 miles north of Baghdad, in 2014 and holds pockets of territory to the north and east of the city.
In a propaganda statement released online, the so-called Islamic State claimed it was targeting gatherings of Shia militias known as the Popular Mobilisation Committees with Thursday and Friday’s attacks.
The terrorist group often makes similar claims about attacks on civilian areas, including a car bombing that killed more than 60 people in a crowded market in Baghdad on Wednesday.
It was followed by two more blasts in the afternoon and a twin suicide bombing at dawn the following day, killing more than 100 victims in the deadliest 24 hours so far this year in Iraq.
Iraqi authorities are facing scrutiny over security breaches in Baghdad, and police sources said the Balad attackers had passed three checkpoints.
On Friday, Iraq's top Shia cleric Grand Ayatollah Ali al-Sistani condemned the wave of attacks and said the government is ultimately responsible for such security breaches, following protests in Baghdad’s Sadr City district and calls for the defence secretary and Prime Minister to resign.
The country is also struggling with a political crisis over a cabinet overhaul that has crippled the government for weeks and seen protesters storm parliament buildings.
The UN's Special Representative for Iraq, Jan Kubis, warned last week that the deadlock and civil unrest threatened to undermine progress re-gaining territory from Isis and urged Iraqi authorities not to underestimate a “formidable and determined enemy”.
The Soufan Group, a US-based intelligence firm, warned that the tempo of attacks would only increase with the approach of the holy month of Ramadan, continuing political turmoil and military pressure Isis is facing across its territories.
Shia civilians, police forces, soldiers and the security services are among those targeted by the organisation, which has declared Shia Muslims apostates and regards the Iraqi government as allies of Western “crusaders”.
According to the United Nations at least 741 Iraqis, including more than 400 civilians, were killed in April and 1,374 wounded due to the ongoing violence.
Additional reporting by agencies
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies