Three men opened fire with machine guns at the al-Furat Cafe in the mainly Shia town of Balad on Friday, the BBC reports.
The assailants fled and hours later one blew himself up after being cornered by Shia militiamen, killing four of them.
In a claim of responsibility, IS said the attack had targeted militiamen and did not mention any connection to Real.
But a statement from Real Madrid said 16 members of a supporters club had died in the attack.
"The club expresses its great sadness and offers its regards and condolences to the families and friends of the victims," the statement said.
A correspondent for the Reuters news agency reported seeing the burned body of one of the suspected assailants outside the cafe.
Residents said they had found the man hiding in a nearby house after the attack and burned him alive after he confessed, the Reuters correspondent added.
Read alsoUp to 64 killed in car bomb attack in Iraq's Baghdad - mediaJavier Tebas Medrano, the president of Spain's La Liga, said he was appalled by the incident.
"Terrorism has attacked football. We are with the victims and their families," he wrote on Twitter. "We were going to travel this month [to Iraq], but it was put off for security reasons. We will be back to support the people of Iraq."
Real Madrid said its players will wear symbolic black armbands in their league match on Saturday against Deportivo La Coruna.