Hamburg: US president Donald Trump won key concessions on climate and trade Saturday from world leaders at a G20 summit in Germany, according to a final statement seen by AFP.

US president Donald Trump, left, talks with German chancellor Angela Merkel at the G20 Summit in Hamburg. AP

The final communique after two days of fractious talks in Hamburg says that the G20 countries "take note" of the US decision to withdraw from the 2015 Paris accord on reducing greenhouse gases.

At the same time it leaves the door open to countries continuing to use fossil fuels, which are blamed for global warming.

It says the US "will endeavour to work closely with other countries to help them access and use fossil fuels more cleanly and efficiently and help deploy renewable and other clean energy sources, given the importance of energy access and security in their nationally determined contributions".

On the key issue of trade, the rest of the G20 was also forced to accommodate Trump and his vow to put "America First" by looking after US companies.

Carried on a wave of public fury over de-industrialisation in vast areas of the United States, Trump had promised to "Buy American" and "Hire American".

But that stance had set him against many of America's allies, who warned Trump against an isolationist path.

Nevertheless, the wording of the final agreement marked the group of top economies' decision to finally close ranks despite bitter differences.

While renewing an anti-protectionist pledge, the communique for the first time underlined the right of countries to protect their markets with "legitimate trade defence instruments".