Leaders of the world's top economic powers have reaffirmed their support for free trade but tempered the statement by acknowledging countries could defend their home companies and markets against unfair practices.
The G20 summit came up with compromise language on trade, although officials struggled to find common ground on another contentious issue, fighting climate change.
In the wake of US president Donald Trump's decision to leave the Paris climate agreement, the group agreed in a draft statement to "take note" of the US withdrawal.
The other 19 reaffirmed support of the Paris deal to limit emissions of greenhouse gases scientists say are behind global warming.
Officials at the summit said the language had been generally agreed on except for part of the climate section. The draft could still change before its final release later.
The talks at the two-day summit in Hamburg competed for attention with violent clashes between anti-globalisation activists and police.
Climate and trade were two of the most contentious issues, in part due to the assertive stance taken on both by Mr Trump.
He has said trade must be fair as well as open and must benefit American companies and workers.
He has focused on trade relationships where other countries run large surpluses with the US, meaning they sell more to US consumers than they buy from American companies.
The G20 typically denounces protectionism, or the use of unfair means to keep out foreign competitors and protect domestic workers and companies.
That stance has been kept, but it has been expanded to include references to the use of "legitimate trade defence instruments" when a country is faced with subsidised or otherwise unfair competition from a trade partner.
Defensive measures are sometimes allowed under the current global trade rules supervised by the World Trade Organisation.
The host, German chancellor Angela Merkel, said after the first day of meetings on Friday that discussions on trade were very difficult and differences on climate change were clear.
Elsewhere at the summit, Russian president Vladimir Putin has met Turkish counterpart Recep Tayyip Erdogan, hailing his contribution to Syria peace efforts.
Mr Putin said at the start that Mr Erdogan's stance "has made it possible to improve the situation in Syria", while Mr Erdogan praised his role and said efforts by Russia and Turkey "set a clear example for the international community".
The leaders of Germany, France and Russia met to discuss the conflict in eastern Ukraine.
The German government said Mrs Merkel, French president Emmanuel Macron and Mr Putin agreed a cease fire forming part of a 2015 peace agreement must be "implemented comprehensively".