Iraq's prime minister vowed on Tuesday to continue the fight against Islamic State of Iraq and Syria (ISIS) militants, a day after the group launched a suicide attack on a shopping mall in the capital, Baghdad, killing 18 people.

Touring the bombed and destroyed mall in the eastern Shia-dominated area of New Baghdad, Haider al-Abadi described the attack as a "desperate attempt" by militants after they lost control of the key western city of Ramadi, the capital of Anbar province.

Iraq's government will "spare no efforts" to expel ISIS forces from the country, al-Abadi said.

Gunmen stormed the Jawhara Mall on Monday after setting off a car bomb and launching a suicide attack at its entrance. Iraqi forces later surrounded the building, landing troops on the roof before clashing with attackers inside, killing two gunmen and arresting four. Along with the 18 killed, around 50 people were wounded.

Shortly after the attack, ISIS posted an online statement saying it targeted an area where many Shia Muslims are known to gather and warned of "worse" to come. The Associated Press could not immediately verify the authenticity of the statement, but its language and phrasing is consistent with past ISIS claims of responsibility.

Shortly after the attack, a back-to-back suicide attack targeted a cafe in the town of Muqdadiyah, about 90 kilometres north of Baghdad in Diyala province, killing at least 24 people and wounding 52. And in a crowded area in southeast Baghdad, a car bomb explosion killed at least five people and wounded 12 others.

All police and health officials spoke on condition of anonymity as they were not authorized to talk to the media.

Iraq is going through its worst crisis since the 2011 withdrawal of U.S. troops. In the summer of 2014, the Islamic State group blitzed across large swaths of the country's north and west, capturing Iraq's second-largest city of Mosul and the majority of the western Anbar province.

Last month, the group suffered a major defeat when Iraqi forces drove the extremists out of the western city of Ramadi, the capital of the sprawling Anbar province. Islamic State still controls much of northern and western Iraq.

Baghdad has been almost quiet over the past few months, except for a few small attacks with bombs and assaults targeting Iraqi forces and government officials.