Hamburg: G20 leaders including US President Donald Trump have reached a compromise on the wording of a final summit statement on trade but remain at odds on climate change, according to an EU source Saturday.

On trade they will commit to fighting protectionism but will also allow "legitimate" measures to protect their markets, the source said on the final day of the talks in Germany.

The outcome represents a compromise with Trump who wants to do more to protect domestic companies from foreign competition through his "America First" policy.

However on climate change negotiators remain at loggerheads following Trump's decision to withdraw the US from the 2015 Paris climate accord, the source said.

The sticking point in the communique is about fossil fuels - blamed for global warming - with the US side wanting to be able to continue to export and promote their use.

"The idea now is to find a good balance of language - it will be discussed this morning," the source said on condition of anonymity.

Trump praises Merkel

Trump praised German Chancellor Angela Merkel for the "fantastic job" organising the G20 summit, despite violent protests that blocked his wife Melania for hours.

Merkel organised the summit "so professionally and without much interruption despite a few people (who) seemed to follow your G20s around," said Trump, telling Merkel that she has "been amazing and done a fantastic job".

Hamburg authorities, meanwhile, braced for another day of demonstrations, after two days of running battles between police and anti-capitalist protestors left 200 officers injured and a trail of destruction.

The clashes meant that US First Lady Melania Trump was unable to join fellow leaders' spouses on a tour of Hamburg harbour, while the car tyres of the Canadian delegation were slashed.

Militants torched cars, smashed windows and broke up paving slabs to throw stones at riot police who resorted to water cannon and tear gas as helicopters buzzed overhead, AFP reporters said.

The activists failed, however, to prevent G20 leaders making it to Hamburg's Elbphilharmonie concert hall for a rendition of Beethoven's ninth symphony. They then went on to a gala dinner.