Iran and China signed a 25-year "strategic cooperation pact" Saturday in the latest expansion of Beijing's flagship trillion-dollar Belt and Road Initiative as the US rivals build closer ties.

Negotiations for the deal, launched five years ago, sparked controversy in Iran last year and virtually no details of its contents have been released.

China is Iran's leading trade partner and was one of the biggest buyers of Iranian oil before then US president Donald Trump reimposed sweeping unilateral sanctions in 2018 after abandoning a multilateral nuclear agreement with Tehran.

The China-Iran pact, which Tehran said included "political, strategic and economic" components, was signed by the two countries' foreign ministers, Wang Yi and Mohammad Javad Zarif, an AFP correspondent reported.

"We believe this document can be very effective in deepening" Iran-China relations, Iran's foreign ministry spokesman Saeed Khatibzadeh said, recalling that the pact had first been proposed during a visit to Tehran by Chinese President Xi Jinping in January 2016.

Xi and his Iranian counterpart Hassan Rouhani agreed then to establish a roadmap for "reciprocal investments in the fields of transport, ports, energy, industry and services."

Xi has championed the Belt and Road Initiative, a plan to fund infrastructure projects and increase China's sway overseas.

In July last year, controversy erupted over the proposed deal after former president Mahmoud Ahmadinejad charged that negotiations were being held for a "new, 25-year agreement with a foreign country" without the knowledge of the Iranian people.

The foreign minister was heckled in parliament when he assured lawmakers there was "nothing secret" in the proposed deal, which he promised would be publicly announced "once it has been finalised".

Iranian Foreign Minister Mohammad Javad Zarif greets his Chinese counterpart Wang Yi ahead of the signing of a 25-year cooperation pact between the US rivals
Iranian Foreign Minister Mohammad Javad Zarif greets his Chinese counterpart Wang Yi ahead of the signing of a 25-year cooperation pact between the US rivals AFP / -

The government has yet to honour that promise and few details have been made public.

Zarif on Saturday called China "a friend in hard times".

According to a statement from his office, he told Wang: "We thank China for its valuable positions and actions in a period of cruel sanctions against Iran."

Wang was also hosted by President Rouhani, who voiced hope that China would "continue to be a major trading partner with Iran" and called for further joint ventures, according to a presidency statement.

Wang's visit to Tehran comes just days after he hosted Russian Foreign Minister Sergei Lavrov for talks in the Chinese city of Guilin.

The three governments all face difficult relations with Washington after President Joe Biden's administration vowed to remain firm in its dealings with them, despite a renewed emphasis on diplomacy.

With Iran facing a crushing economic crisis, Supreme leader Ayatollah Ali Khamenei has called for deeper relations with "trustworthy, independent countries like China".

He had previously described the proposed cooperation agreement as "correct and reasonable".

China and Russia are both parties to the troubled 2015 nuclear accord with Iran that Biden has said he hopes to revive.

They were both deeply critical of the unilateral sanctions on Iran reimposed by Trump and have backed efforts to revive the agreement.

Biden has said he is not seeking "confrontation" with China, but that there will be intense competition between the rival superpowers.

"I told him (Xi) in person on several occasions we're not looking for confrontation, though we know that there will be steep, steep competition," the US president said.