US President Barack Obama on Sunday defended free trade as fellow Asia-Pacific leaders vowed to fight protectionism after Donald Trump's shock election victory sparked fears for the future of global commerce.

Trump's triumph in this month's US presidential poll has raised concerns that years of rolling back trade barriers could be reversed after the populist billionaire vowed to tear up a series of key deals.

His victory overshadowed a summit of the Asia-Pacific Economic Cooperation (APEC) group held in Peru this week where leaders, including Obama, China's Xi Jinping and Russia's Vladimir Putin, found themselves under fierce pressure to defend free trade.

Globalization and trade deals have been increasingly blamed in Europe and America for sending jobs abroad and eroding living standards, concerns reflected in both the election of Trump and Britain's "Brexit" vote in June to leave the European Union.

At the APEC gathering there was particular concern about the future of a major US-backed accord -- the Trans-Pacific Partnership (TPP), which Trump has vowed to kill off -- and that China was positioning itself to forge ahead with its own trade deals and fill a vacuum left by any American withdrawal.

But after the summit closed on Sunday, Obama said that the 12-nation trans-Pacific deal, a key part of his much-vaunted "pivot" to Asia, was far from dead and those involved still wanted to move forward with the United States.

The president also insisted trade was positive as long as it was carried out in the right way and sought to answer rising concerns about globalization, conceding that "historic gains in prosperity" had not been evenly distributed.

"That can reverberate through our politics," he said.

"That's why I firmly believe one of our greatest challenges in the years ahead across our nations and within them will be to make sure that the benefits of the global economy are shared by more people."

And he sent a message to a world that is increasingly wary of globalization: "The answer is to do trade right."

Story continues

- 'Fight protectionism' -

Obama's concerns about growing inequality were echoed by other leaders at the gathering, with Singaporean Prime Minister Lee Hsien Loong saying steps must be taken to ensure that "no groups in society are left behind."

"Only then can we push ahead with trade and economic cooperation," he said.

APEC's 21 members from either side of the Pacific offered their own staunch defense of free trade as the annual summit ended, pledging to "fight against all forms of protectionism."

In addition the group vowed to refrain from competitive devaluation of their currencies, after Trump repeatedly accused China of keeping the yuan undervalued to boost exports and threatened to declare Beijing a currency manipulator.

But analysts were not convinced by the APEC statement, with senior analyst Jeffrey Halley at forex broker Oanda saying it sounded like "empty rhetoric."

"Most participants have very different definitions of what constitutes open markets and protectionism," he said.

While Obama sought to be upbeat about the TPP's prospects, some experts say Trump's attacks on the agreement -- which he called a "terrible deal" -- and his Republican allies' control of Congress mean it is dead in the water.

Other observers have suggested that the deal-making real estate mogul may seek to negotiate changes to the agreement once he takes office in January, and then claim a victory if a new version is passed.

A failure of the TPP would likely be welcomed by China, which was excluded from the deal and saw it as an attempt by the US to increase its clout in Beijing's backyard.

As the summit concluded Sunday, Chinese foreign ministry official Tan Jian took a veiled swipe at America, saying that countries "should not politicize free trade arrangements."

Trump's victory and the potential demise of the TPP means that even longtime US allies may soon be turning to Beijing in a region hungry for trade.

President Xi set himself up as the anti-Trump at this week's summit, defending open markets and pushing two rival agreements -- an APEC-wide deal and a 16-member accord that excludes the US.