China on Wednesday urged restraint from all sides after Iran launched missiles at Iraqi bases housing US and British troops, saying Beijing would play a "responsible role" in helping to defuse tensions

Iran fired more than a dozen ballistic missiles overnight at Iraqi bases housing coalition forces, the first act of the Islamic republic's promised revenge for the US killing of top general Qasem Soleimani last week.

"It is not in the interest of any party that the situation in the Middle East worsens further," foreign ministry spokesman Geng Shuang said at a regular press briefing.

"We call on the parties concerned to exercise restraint," he said.

Geng said China would "play a responsible role in promoting a de-escalation of the situation as soon as possible".

China, a permanent member of the UN Security Council, is a key partner of Iran and a major buyer of the country's oil.

"China has always advocated that all parties concerned should properly resolve their conflicts and differences through dialogue, negotiation and other peaceful means," Geng said.

Iran's embassy in Beijing posted on Wednesday an announcement on China's Twitter-like Weibo platform that "the end of America's evil influence in West Asia has begun".

The post was "liked" more than 380,000 times on Wednesday, with multiple commenters cheering Iran.

"Support the people of Iran in attacking the world's number-one terrorist!" one user wrote.

Others called the people of Iran "brothers," and some said they wished to donate money to Tehran.

Iran, China and Russia held joint naval drills in the Indian Ocean and the Gulf of Oman in December and the Iranian foreign minister visited Beijing on New Year's Eve.

China and Russia are also parties to the 2015 nuclear deal with Iran, from which Trump withdrew in May last year.

The deal is now unravelling, with Tehran announcing on Sunday that it would rollback the limit on the number of centrifuges used in uranium enrichment, one of its commitments under the agreement.