Negotiators from the world's 20 top economies were expected to have worked all night trying to hammer out a final summit statement that at least gives the impression of unity.
Hamburg authorities meanwhile braced for another day of demonstrations, after two days of running battles between police and anti-capitalist protesters left 200 officers injured and a trail of destruction.
Trump vs. Putin
The summit has been anything but harmonious inside the heavily guarded venue as world leaders struggled to adjust to the unorthodox approach of the new occupant of the White House.
Trump's most eagerly awaited encounter was a bruising head-to-head – their first – with Russia's strongman President Vladimir Putin lasting two and a quarter hours.
On the presidential election campaign trail last year, Trump said he hoped relations with Putin could be rebuilt after Russia's acrimonious ties with his predecessor Barack Obama.
A day after Trump slammed Moscow's actions in Ukraine and Syria, the two men Friday had a “robust and lengthy exchange” about allegations of Russian meddling in the 2016 US election, Secretary of State Rex Tillerson said.
But Tillerson, who was present at the marathon meeting, said also that the two alpha-male leaders “connected very quickly” with “very clear positive chemistry”.
“Neither one of them wanted to stop,” he said. “I believe they even sent in the (US) First Lady at one point to see if she could get us out of there.”
Trump also met Mexican counterpart Enrique Pena Nieto for the first time as president and insisted that Mexico would “absolutely” pay for his planned border wall.
The issue of who would stump up the cash for Trump's signature election campaign pledge was not covered in the actual talks, Mexico's Foreign Minister Luis Videgaray said.
“We didn't touch on that subject in our conversation… partly because we have a well-known, significant difference of opinion on that,” Videgaray said.
On Saturday Trump was due to meet Chinese President Xi Jinping. Thorny issues there include North Korea after this week's latest missile test, US arms sales to Taiwan and Chinese steel exports.
Storm over climate
But if Trump and Putin established a rapport, the distance between the US leader and America's long-standing partners has widened with his climate-sceptic opinions and “America First” policy.
The growing rift has turned this year's G20 summit — normally a ripple-free event in the diplomatic calendar — into one of the stormiest in the forum's history.
A draft communique seen by AFP Friday appeared to reflect the 19-versus-one stance on climate.
It underlines that the 2015 Paris climate accord is “irreversible” and affirms that other G20 nations are committed to the deal while taking note of Washington's decision to quit the agreement.
On trade it appeared that the final communique would stress the importance of free trade but also recognise the right of countries to defend itself against uncompetitive practices.
“This would be a first,” one source said.
The violent clashes in Hamburg 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.
“War, climate change, exploitation are the result of the capitalist system that the G20 stands for and which 20,000 police are here to defend,” demonstrator Georg Ismail told AFP.
German Chancellor Angela Merkel said she could understand peaceful protests, but demonstrations that “put people’s lives in danger, put the protesters' own lives in danger… are unacceptable”.
But the influential Bild daily slammed Merkel in a stinging editorial, calling the summit a “debacle” for the chancellor ahead of elections in September.
“Of course the police did all it could. But the street belonged to the mob. The feeling of general security that the state must guarantee has ceased to exist in Hamburg over the last 48 hours,” Bild thundered.