Leaders of the Group of 20 have agreed to fix the world trading system — but only 19 of them will support the Paris accord on fighting climate change.

Applause rose up in the hall on Saturday as the leaders signed off on a final statement at the end of a two-day summit.

The statement acknowledges flaws in the world trading system and calls for reforming the World Trade Organisation (WTO) – but does not mention protectionism because negotiators said the US had resisted that.

The statement says 19 of the members reiterated their commitment to the Paris climate accord but the US reiterates its decision to withdraw.

The non-binding agreement was reached after difficult all-night talks by diplomats.

The US had been the main holdout on nearly every issue, officials previously said, as US President Donald Trump has criticised the WTO and taken aggressive trade policies targeting China and the EU.

China also pushed back in talks on steel, South Africa objected to language on trade, Australia did not want the statement to be too soft on migration and Turkey worried it would push too far on climate change, according to the officials.

According to European officials, the US negotiator said too much talk about migration would have been a “deal-breaker” for Mr Trump.

This led to them coming up with “minimalist” language that acknowledges growing migrant flows and the importance of shared efforts to support refugees and solve the problems that drive them to flee.

The statement also shows a commitment to a “rules-based international order,” despite Mr Trump’s rejection of many of those rules.

“There were moments when we thought all was lost,” one European official said, “moments when we spent two hours on one sentence.”

Perhaps surprisingly, one country seen as particularly constructive was Russia, the officials added.

Despite tensions over its military actions on Ukraine and political interference abroad, Russia supports international efforts on trade and climate.

Erdogan and Putin at G20 SummitTurkey’s President Recep Tayyip Erdogan with Russian President Vladimir Putin (Mikhail Klimentyev, Sputnik, Kremlin Pool Photo via AP)

While a statement is not legally enforceable, the Europeans see it as proof the G20 is still relevant and multilateralism still works.

German Chancellor Angela Merkel said: “Everyone agrees that the WTO should be reformed. This is an important agreement.”

“We will send a clear signal — in any case, most of us” — for the success of global climate talks starting in Poland on Sunday, Ms Merkel added.

Her spokesman said that during a meeting with Russian President Vladimir Putin, she also voiced concern about rising tensions in the Kerch Strait off Crimea and pushed for “freedom of shipping into the Sea of Azov”.

Last weekend, Russia seized three Ukrainian naval vessels and their crews in an incident escalating a tug-of-war that began in 2014 when Russia annexed Ukraine’s Crimean Peninsula and supported separatist rebels in eastern Ukraine.

Germany and France have sought to mediate between Russia and Ukraine, and spokesman Steffen Seibert said Ms Merkel and Mr Putin agreed the four countries should hold further talks at the “adviser level”.

Merkel and Trump at G20US President Donald Trump listens to Germany’s Chancellor Angela Merkel (Pablo Martinez Monsivais/AP)

Ms Merkel also said she hopes a meeting between the US and Chinese leaders will help resolve trade tensions between the two countries.

Mr Trump and Chinese President Xi Jinping are due to meet on the sidelines of the summit in Buenos Aires.

Ms Merkel told reporters it is important the talks “hopefully bring solutions, because all of us see that we are affected indirectly when Chinese-American economic relations are not as frictionless as a world order requires”.

The divisions among the world’s leading economies were evident from the moment Argentina’s president opened the summit Friday with a call for international cooperation to solve the planet’s problems.

In closing remarks, summit host and Argentine President Mauricio Macri said the countries had overcome “a number of challenges” to reach the agreement.

He said: “We have agreed on a statement that reflects the necessity of revitalising trade, of revitalising the WTO.

“We ratify the concern of everyone over climate change.”

The next G20 summit is to be held in Osaka, Japan, in June 2019.