HAMBURG (BLOOMBERG) - Donald Trump, Xi Jinping and other Group of 20 leaders were already seated in the hushed auditorium of Hamburg's US$900 million (S$1.24 billion) concert hall when Angela Merkel walked in to a spontaneous burst of cheers and applause.
With the world's attention on the German chancellor during her biggest global summit yet, the surprise moment at the 2,100-seat Elbphilharmonie shows both Merkel's international standing and the risks that come with it.
After hosting two days of "difficult" talks, Merkel can claim the credit for avoiding an open break with the US president over trade and keeping the other 19 nations united behind climate goals that Trump has rejected.
JOBS, CLIMATE AND STEEL: TAKEAWAYS OF TRUMP'S EFFECT ON THE G-20
Less than three months before Germans go to the polls, Merkel's ability to seize the middle ground gives more than just Germany a keel of stability in uncertain times. That deft political navigation has helped keep her in office for 12 years and might win her four more.
"Her achievement was holding the group together despite some clear differences," said Daniel Hamilton, executive director of the Center for Transatlantic Relations at the Johns Hopkins School of Advanced International Studies in Washington.
"That's quite an achievement at this moment when everything seems to be falling apart."
Even as the US drifted further away from its traditional allies on key issues, Merkel made good on her pre-summit promise of seeking as much consensus as possible without papering over differences, a point she hammered home at her closing news conference.
Her balancing act of looking for points of agreement, keeping Trump at arm's length and defending German interests has so far played well with voters.
Asked who is the stronger leader, 77 per cent of respondents picked Merkel, compared to 12 per cent who chose Martin Schulz, her Social Democratic challenger in September's election, according to an Infratest Dimap poll published Thursday.
This time in Hamburg, she even won praise from Trump, who went home with concessions on what the US views as fair trade in return for backing a pledge to keep markets open.
"Your leadership is absolutely incredible and very inspiring," the president said at a side event on women's entrepreneurship with Merkel and Ivanka Trump, his daughter and White House adviser.
While G-20 leaders struggled for most of the two days to find a diplomatic compromise, Merkel's firm spot at center-stage left her domestic opponents sniping from the sidelines.
Foreign Minister Sigmar Gabriel, whose Social Democrats are Merkel's coalition partner as well as main election challenger, renewed his party's accusations that the chancellor is soft on Trump for refusing to reject pressure for higher defense spending - a topic that didn't figure at the summit.
There's a "credibility gap" between Merkel's criticism of the US and the policies she pursues in practice, Gabriel told the Passauer Neue Presse newspaper.
Written off a year ago as Germans blamed her for a record influx of refugees, Merkel headed into the summit with her Christian Democrat-led bloc leading the Social Democrats by as much as 16 percentage points in national polls.
Yet even as Merkel blushed at the applause before a performance of Beethoven's Ninth Symphony, away from the plush new concert hall on the port city's waterfront, other parts of Hamburg were engulfed in riots by anti-globalisation groups protesting the summit.
The damage caused and police resources expended may yet become a political liability for the chancellor as the campaign begins.
Merkel sought to counter domestic critics who say holding the summit in the center of Germany's second-biggest city was a mistake.
Addressing a group of police officers as leaders headed home, she said: "You provided security for something that I believe was worth securing."
Germany's anti-capitalist Left party said Merkel "doesn't look very different" from summit participants like Trump, Russian President Vladimir Putin or Turkey's Recep Tayyip Erdogan.
"The G-20 is an anachronism and this summit is a fiasco for democracy," party co-head Katja Kipping told a rally in Hamburg on Saturday. In the end, Merkel's main achievement may be restoring a sense of German order to a disorderly world.
The chancellor didn't want to "lose the US across the board," said Jan Techau, head of the Richard Holbrooke Forum at the American Academy in Berlin.
"That didn't happen, so that's a success. We didn't have that kind of G-20 dysfunction."