President Hassan Rouhani has said he wants more talks with Russia about the "illegal" US withdrawal from the Iran nuclear deal as China pledged to continue trade with Tehran.

Chinese Foreign Ministry spokeswoman Hua Chunying said Beijing has always objected to any imposition of unilateral sanctions against other nations based on domestic laws.

Chunying told IRNA that China and Iran have always maintained their economic and trade ties, and will continue such relations based on international rules and regulations. She said global powers must be the role models and pioneers of respecting international agreements.

Beijing, she said, has been clear about its position on the nuclear agreement, and believes that following international agreements is among the key principles of international laws.

The spokeswoman added that China will “seriously” continue its cooperation with the European Union to safeguard the Iran nuclear deal with “power and authority”.

She made the remarks as the Iranian president traveled to China to participate at a summit of the Chinese and Russian-led security bloc, the Shanghai Cooperation Organization (SCO).

Rouhani, speaking at the summit in the port city of Qingdao Saturday, said that Russia's role in implementing the nuclear deal had been "important and constructive."

The summit is expected to witness Russia and major Asian partners throw support behind the Islamic Republic in the face of the US pressure.

Iran’s President Hassan Rouhani meets with Pakistani counterpart Mamnoon Hussain on the sidelines of a Shanghai Cooperation Organization (SCO) summit in Beijing, June 9, 2018. (Photo by IRNA)

Meeting with his Pakistani counterpart Mamnoon Hussain on the sidelines of the summit, Rouhani urged international reaction against Washington’s unilateralism targeting Tehran.

He said Trump’s walkout of the nuclear deal violated international rules and regulations as well as the UN Security Council resolutions. The UNSC had ratified the nuclear agreement into a resolution.

The Pakistani statesman, for his part, called the JCPOA a model for peaceful resolution of international crises.

Both sides stressed their resolve to deepen their economic, energy, and security relations, with Rouhani stating that Iran could be a “secure source” of energy for its neighbors.