President Xi Jinping of China has offered a vigorous defence of globalisation and free trade in a speech at the World Economic Forum in Davos.

Comparing protectionism with "locking oneself in a dark room" to avoid danger, but at the same time depriving the room of "light and air", he cautioned other countries against pursuing their own interests at the expense of others on Tuesday.

Xi did not mention the US president-elect, Donald Trump, in his speech of nearly an hour but many of the messages he sent seemed directed at Trump, who campaigned for the White House on pledges to protect US industries from foreign competition and levy new tariffs on goods from China and Mexico.

"No one will emerge as a winner in a trade war," Xi told the forum in the Swiss Alps.

He said economic globalisation has become a "Pandora's Box" for many, but that it was not the cause of many global problems.

Xi said the international financial crises were caused by the excessive pursuit of profits, not globalisation.

"China has no intention to boost its trade competitiveness by devaluing the renminbi, still less will it launch a currency war," he said.

His appearance, a first for a Chinese leader at the annual meeting of political leaders, chief executives and bankers in Davos, came as doubts emerge about whether the US will remain a force for multilateral cooperation on issues like trade and climate change.

Complaints about China

Xi's vocal support for free trade and criticism of protectionism could appear rich to other Western countries, who have grumbled about commercial restrictions in China that clash with the public assertions from officials.

Foreign companies complain that China is reducing access to its markets for electric cars, computer security technology and other promising fields or pressing them to give know-how to potential Chinese competitors.

Some say they are blocked from acquiring assets in China, just as Chinese companies have been on a foreign buying spree.

OPINION: Trump era heightens Asia-Pacific's tripwires

"The political leadership of China never ceases to assure us that further opening towards foreign investment ... is a priority," Michael Clauss, Germany's ambassador to China, said this week.

"However, many companies keep telling us that their difficulties in these areas have increased."

"It often appears that somewhere down the line, political assurances of equal treatment give way to protectionist tendencies."

China also faces US and European complaints it is exporting steel, aluminium, solar panels and other goods at improperly low prices, threatening thousands of jobs abroad.

Sign of shift

Klaus Schwab, WEF founder, said Xi's presence was a sign of the shift from a unipolar world dominated by the US to a more multi-polar system in which rising powers, such as China, will have to step up and play a bigger role.

"In a world marked by great uncertainty and volatility, the world is looking to China," he said before Xi spoke.

Europe is preoccupied with its own troubles, from Brexit and attacks to the string of elections this year in which anti-globalisation populists could score gains.

The bumpy run-up to the Trump administration has given China's Xi a convenient opportunity to advance his goal of giving his country a more assertive leadership role on the world stage.

China previously sought to capture the mantle as a supporter of world trade after Trump said he would pull the US out of the 12-nation Trans-Pacific Partnership trade deal championed by President Barack Obama.

'Biggest challenge'

In his speech, Xi described the world economy as adrift, saying it lacked a "driving force" with inadequate global governance and unequal benefits that have widened the gulf between rich and poor.

"This is the biggest challenge in the world today," he said.

He called for a "new growth model" that takes into account climate change, ageing populations and increased automation, and said countries that face difficulties should not "lose confidence or run away from our responsibility; instead, we should join hands".

Xi hit hard on the metaphor of the world economy as an "ocean," saying countries "must have courage to swim in the global market".

"We should not develop a habit of retreating to the harbour whenever encountering the storm, for this will never get us to the other shore of the ocean," he said.

More than half a dozen senior Chinese government figures are in Davos this week, far more than in past years. And a large number of sessions are focused on Asia, including one entitled "Asia Takes the Lead".