Leaders of seven biggest economies known as the G7 have found common cause on fighting terrorism, but failed to bridge a gulf between US President Donald Trump and other leaders on trade and climate change.

On the opening day of a two-day summit, the leaders endorsed on Friday a call by the UK urging internet service providers and social media companies to crack down on the dissemination of content that inspires violence in the name of religion.

In a joint statement on terrorism, the G7 powers also vowed a collective effort to track down and prosecute foreign fighters dispersing from Syria and other conflict zones.

But US partners hit deadlock in their attempt to persuade Trump to keep the world's biggest economy inside the framework of the 2015 Paris Agreement on curbing carbon emissions to reduce global warming.

Tensions over trade also flared. Leaders made no effort to hide their divisions in Sicily's ancient hilltop resort of Taormina.

The choice of venue overlooking the Mediterranean reflected the Italian hosts' desire for the summit to showcase cooperation against deadly flows of illegal migration from nearby Africa.

But discussions on that subject also hit stalemate because of differences with the US at what EU President Donald Tusk called "the most challenging G7 summit in years".

'Evolving views'

Italian Prime Minister Paolo Gentiloni acknowledged there had been no breakthrough on climate change, describing the future of the Paris pact as "still hanging", as Trump reviews the arguments for and against the US ditching the global deal.

Gary Cohn, Trump's economic advisor, said the president's views were "evolving".

"He came here to learn," Cohn said. "His basis for decision ultimately will be what's best for the United States."

Also in Brussels, Trump had fired an extraordinary broadside at NATO allies for failing to pay their fair share of the transatlantic defence bill, and notably did not endorse the group's commitment to collective defence, as his predecessors have done.