Iraq asked the ambassador to leave its territory and recalled its charge d’affaires from Stockholm as the stunt took place outside its diplomatic mission in Sweden.
Salwan Momika kicked the Quran around on a patch of grass as police looked on, after they had granted him a permit to hold a gathering outside the Stockholm embassy. The holy book was not set on fire.
A crowd had earlier stormed the Swedish embassy in Baghdad and started a fire in protest at Sweden's stance on burning the Quran.
Baghdad had said it was prepared to cut diplomatic ties with Sweden over the sensitive issue of desecrating holy books.
Prime Minister Mohammed Shia Al Sudani "has directed the Ministry of Foreign Affairs to withdraw the Iraqi charge d'affaires from the embassy in the Swedish capital, Stockholm", his spokesman Yahya Rasool said.
"He also directed the Swedish ambassador in Baghdad to leave Iraq, in response to the Swedish government's repeated permission to burn the Quran," Mr Rasool said on Twitter.
Mr Al Sudani said Iraq had informed Sweden through diplomatic channels that "any recurrence of the incident involving the burning of the Holy Quran on Swedish soil would necessitate severing diplomatic relations".
Iraq has also suspended the working permit of Swedish telecoms company Ericsson, state media reported.
Swedish businesses expressed concern about the fallout from the desecration. Swedish exports to Iraq are viewed as a small market, but there could be bigger ramifications if the backlash were to spread to other countries.
“If it spreads it could have serious consequences,” said Stefan Karlsson, chief analyst at the Swedish Export Credit Agency. Almost 2 per cent of Swedish exports go to the Middle East.
Kuwait has already imposed a ban on the sale of products made by countries involved in Quran burning. The measure would also ban exports to countries that “violate Islam’s principles”.
Sweden's Foreign Minister Tobias Billstrom accused Iraq of failing to protect its embassy staff in Baghdad.
“Iraqi authorities have an unequivocal obligation to protect diplomatic missions and diplomatic personnel under the Vienna Convention. It is clear that the Iraqi authorities have seriously failed in this responsibility,” he said.
Baghdad's Foreign Ministry also condemned the assault on Sweden's embassy, which said it had closed to visitors without specifying when it would reopen.
“This act comes in the context of assaulting diplomatic missions and threatening their security,” the Iraqi ministry said.
The government has instructed security officials to open an urgent investigation and “take all the necessary measures to identify the perpetrators of this act and hold them to account", it said.
Adam Samara, a spokesman for the Swedish police, told local press the country was keeping its terrorist alert on review, warning that protests could spread quickly if fuelled by social media reaction.
"Even if the terrorist threat level remains at the same elevated level as before, Sapo are following the developments closely," he said. "We know that it can happen quickly, but our mission is to make assessments of the threat picture against Sweden and determine if there are individuals who have the intention and ability to commit crimes against Sweden and Sweden's security."
Staff at the embassy are safe, Sweden's Foreign Ministry said. The US condemned what it called an unlawful act of violence in Baghdad.
US State Department spokesman Matthew Miller said it was "unacceptable that Iraqi security forces did not act" to prevent protesters breaching the compound.
"We are in contact with our Swedish partners and have offered our support. Foreign missions should not be targets of violence," he said.
Sweden had granted a permit to Mr Momika to assemble outside the embassy in Stockholm. He had indicated he planned to burn a Quran and an Iraqi flag.
Iraq's decision to recall its charge d'affaires from Sweden came while the protest in Stockholm had started but before the protesters had left without burning the Quran.
Swedish police maintain they only approve gatherings and not what happens there. But protests have taken place in several Muslim countries against Sweden's stance on free expression.
A permit was granted last week to an activist who had said he was intending to burn the Torah but he ultimately chose not to do so. The EU has condemned the burning of religious texts but says it is up to individual states to decide whether to punish such acts.
The protest in Baghdad was called by supporters of Shiite populist cleric Moqtada Al Sadr.
A Telegram channel aligned with Mr Al Sadr, called One Baghdad, showed people gathering around the embassy in the Iraqi capital about 1am on Thursday and storming it an hour later.
Iraqi riot police fired water cannon to disperse demonstrators while security forces armed with electric batons chased protesters, an AFP photographer on the scene said.
“We are mobilised today to denounce the burning of the Quran, which is all about love and faith,” protester Hassan Ahmed said. “We demand that the Swedish government and the Iraqi government stop this type of initiative.”
Several fire engines arrived at the embassy, where skirmishes between Iraqi security forces and demonstrators had broken out, the photographer said.