BUENOS AIRES (Reuters) - Chinese President Xi Jinping and the leaders of major developing economies condemned protectionism at a G20 summit in Argentina on Friday overshadowed by U.S. President Donald Trump’s threat to escalate tariffs on China.

This year’s two-day gathering is a major test for the Group of 20 industrialized nations, whose leaders first met in 2008 to help rescue the global economy from the worst financial crisis in seven decades.

With a rise in nationalist sentiment in many countries, the G20 - which accounts for two-thirds of the world population - faces questions over its ability to deal with trade tensions, which have roiled global markets.

Hanging over the summit in Buenos Aires is the trade dispute between the United States and China, the world’s two largest economies, which have imposed tariffs on hundreds of billions of dollars worth of each other’s imports after Trump launched an effort to correct what he views as China’s unfair commercial practices.

Global financial markets will take their lead next week from the outcome of talks between Trump and Xi over dinner on Saturday, aimed at resolving differences that are weighing on global economic growth.

Xi and other leaders from the BRICS group of leading emerging economies - Brazil, Russia, India, China and South Africa - issued a statement calling for open international trade and a strengthening of the World Trade Organization (WTO).

“The spirit and rules of the WTO run counter to unilateral and protectionist measures,” they said. “We call on all members to oppose such WTO-inconsistent measures, stand by their commitments undertaken in the WTO.”

Beijing hopes to persuade Trump to abandon plans to increase tariffs on $200 billion of Chinese goods to 25 percent in January, from 10 percent at present.

U.S. stocks closed higher on Friday on hopes that a deal could be reached.

Trump said there had been some positive signs.

“We’re working very hard. If we could make a deal that would be good. I think they want to. I think we’d like to. We’ll see,” he said.

A Chinese foreign ministry official in Buenos Aires said there were signs of increasing consensus ahead of the discussions, although differences remained.

SEEKING COMMON GROUND

On the eve of the summit, G20 nations were still trying to reach consensus on wording for the summit’s communique on major issues including trade, migration and climate change, which in past years have been worked out well in advance.

Officials hammering out the communique, known as “sherpas,” said they expected to work into the night.

“This has been an unprecedentedly long drafting,” said Russia’s sherpa, Svetlana Lukash. “It’s very complicated,” she said, adding that differences remained on all the key issues.

Earlier in November, officials from countries attending a major Asia-Pacific summit failed to issue a joint statement for the first time after the U.S. delegation clashed with China over trade and security.

However, delegates to the Buenos Aires talks said good progress had been made on economic sections of the final communique. Argentina’s presidency voiced cautious optimism that consensus would be reached, but a White House official said the United States would walk away from any statement that prejudiced U.S. interests.

Highlighting the deep rifts within the G20, European Council President Donald Tusk said the European Union would extend its economic sanctions on Moscow in December, after Russian ships fired on Ukrainian vessels in the Sea of Azov last week, seizing the boats and sailors.

“As this is a difficult moment for international cooperation, I would like to appeal to the leaders to use this summit ... to seriously discuss real issues such as trade wars, the tragic situation in Syria and Yemen and the Russian aggression in Ukraine,” Tusk told a news conference.

Trump cited Russia’s seizure of the ships as the reason he canceled a planned bilateral meeting with Russian President Vladimir Putin, where they had been expected to discuss the U.S. leader’s threat to withdraw from the Cold War-era Intermediate-Range Nuclear Forces treaty.

Slideshow ( 22 images )

Moscow said U.S. domestic politics may have been the real reason behind the cancellation after Trump’s former personal lawyer pleaded guilty on Thursday to lying to Congress about a proposed Trump Organization skyscraper in the Russian capital.

A White House spokeswoman denied this and Trump said on Friday the ships’ seizure was the “sole reason” he scratched the meeting.

A Kremlin spokesman said Putin was ready to continue talks with Trump.

LONELY SAUDI PRINCE

The presence of Crown Prince Mohammed bin Salman at the summit also raised an awkward dilemma for leaders, and Saudi Arabia’s de facto leader cut a lonely figure standing at the edge of the G20 family photo.

Slideshow ( 22 images )

Prince Mohammed arrived under swirling controversy over the murder of Saudi journalist Jamal Khashoggi in the Saudi consulate in Istanbul on Oct. 2. Human Rights Watch asked Argentine prosecutors to investigate him for human rights abuses.

U.S. Secretary of State Mike Pompeo and Saudi Foreign Minister Adel al-Jubeir discussed the importance of making progress in the investigation into Khashoggi’s killing during talks in Buenos Aires on Friday, the U.S. State Department said.

British Prime Minister Theresa May told the prince that the killers of Khashoggi should be held to account, her office said after the two leaders met. Saudi Arabia said the prince had no prior knowledge of the murder.

French President Emmanuel Macron told the prince in a separate meeting that Europeans will insist on international experts being part of the investigation into Khashoggi’s killing.

Oil markets were awaiting a bilateral meeting between Putin and Prince Mohammed on Saturday afternoon for any sign that Russia will participate in a production cut by the OPEC oil cartel next month.

Putin was the only leader to exchange a warm greeting with the prince, high-fiving him when he entered the main summit room.

TRUMP AND TRADE

One bright spot before the summit opened was the signing of a revised U.S.-Mexico-Canada trade pact to replace the North American Free Trade Agreement.

Signing the agreement alongside Canadian Prime Minister Justin Trudeau and Mexican President Enrique Pena Nieto, Trump said he looked forward to working with the U.S. Congress to complete the terms of the deal and did not anticipate problems.

The three countries agreed a deal in principle to govern their trillion dollars of mutual trade after a year and a half of contentious talks concluded just an hour before a deadline on Sept. 30.

Trudeau still had a few barbs on Friday. He called the deal by its old name NAFTA, prodded Trump over U.S. steel and aluminum tariffs and said General Motors Co’s decision to cut production and its North American workforce, including in Canada, was a “heavy blow.”