Donald Trump has declared the G20 summit in Germany a “wonderful success”, despite his country’s isolated position on climate change.
In a joint statement, the leaders of 18 nations and the EU recognised the US decision to withdraw from the Paris climate agreement.
However, they also said other G20 members remained committed to the “irreversible” accord.
Deadlock over the issue had held up the last day of talks in Hamburg.
A final agreement was eventually reached and the joint summit statement was officially released on Saturday.
The statement also said the US would seek “to work closely with other countries to help them access and use fossil fuels more cleanly and efficiently”.
The Paris accord sets targets for greenhouse gas emissions aimed at curbing global temperature increases.
In her closing news conference, German Chancellor Angela Merkel, who hosted the summit in Hamburg, said she still deplored Mr Trump’s position but that she was “gratified” the other 19 nations opposed its renegotiation.
However Turkish President Recep Tayyip Erdogan later said that his country’s ratification of the Paris accord was now in doubt, as the US withdrawal jeopardised compensation for developing countries.
Mr Erdogan said that when Turkey signed the accord, France had promised that Turkey would be eligible for compensation for some of the financial costs of compliance.
“So we said if this would happen, the agreement would pass through parliament. But otherwise it won’t pass,” Mr Erdogan told a news conference, adding that parliament had not yet approved it.
Mr Trump also won a concession on trade, with leaders underlining the right of countries to protect their markets with what they referred to as legitimate trade defence instruments.
He later tweeted: “The #G20Summit was a wonderful success and carried out beautifully by Chancellor Angela Merkel. Thank you!”
Mr Trump held his final talks of the event with Chinese President Xi Jinping, and the two leaders discussed efforts to rein in North Korea’s nuclear ambitions.
The US president told his Chinese counterpart that “something has to be done” after Pyongyang tested an intercontinental ballistic missile with the potential to hit the US state of Alaska on Tuesday.
President Xi said he supported denuclearisation of the Korean peninsula, and said the China US relationship had made “progress… despite some sensitive issues”, state news agency Xinhua said.
Mr Xi suggested visits between the two countries’ defence ministers, Xinhua added.
There were violent protests in the early hours of Sunday, with demonstrators setting cars on fire and throwing projectiles.
Hamburg has seen several days of anti-G20 demonstrations, with some of the rallies turning violent.
Police say 213 officers were injured, and 143 people were detained at the protests.
The demonstrators were protesting against the presence of Mr Trump and Vladimir Putin, as well as climate change and global wealth inequalities.