Globalization has brought many economic benefits to the world, but needs a "course correction" to address growing inequality, US President Barack Obama said Wednesday on his European farewell tour.

Obama spoke during a visit originally planned as a valedictory lap, but which has become focused on reassuring jittery allies after the shock election victory by Donald Trump, a staunch critic of free trade agreements.

"The global path of globalization demands a course correction," Obama said in an eagerly awaited speech in Athens, before continuing his journey to Berlin. 

"When we see people, global elites, wealthy corporations seemingly living by a different set of rules, avoiding taxes, manipulating loopholes ... this feeds a profound sense of injustice," he added.

Watch his full remarks here:

During the trip, the outgoing president has repeatedly referred to the anger that lately brought success to populist movements in Europe and the United States, such as the Brexit referendum and Trump's shock victory last week.

In comments Tuesday Obama cautioned the world must guard against "a rise in a crude sort of nationalism or ethnic identity or tribalism that is built around an 'us' and a 'them.'"

European governments, especially eastern countries close to Russia's orbit, have been shaken after Trump appeared to call into question Washington's near 70-year security guarantee by saying he would only help NATO allies if they paid their way.

Trump welcomed Britain's shock vote in June to leave the European Union (EU) and has been a critic of global free trade agreements. 

However, Obama was at pains to stress that Europe — and NATO — would remain the cornerstone of US foreign policy.

The US-led NATO grouping is "absolutely vital" to US interests and a strong, unified Europe was good for America and the world, Obama said in comments aimed at reassuring old partners.

"We know what happens when Europeans start dividing themselves up... the 20th century was a bloodbath," he said pointedly on Tuesday.

Following his speech, the president will head to Germany to visit Chancellor Angela Merkel, whom he has described as "probably... my closest international partner these last eight years."

During his time in Berlin, he will also huddle with the leaders of Britain, France and Italy, as Europe desperately seeks clues to future US policy in a Trump world.

While Obama has generally been welcomed in Greece, there were some who came out onto the streets in protest.

Around 2,500 people brandishing banners denouncing US "imperialism" and calling Obama a "persona non grata" were turned away on Tuesday as they tried to breach barriers and reach the city centre, with police firing tear gas and stun grenades.

Many Greeks are suspicious of Washington after it helped install a repressive seven-year dictatorship in the country in the 1960s, and trade unions, leftist and anarchist parties have denounced US involvement in wars in the Middle East.

Several hundred of the protesters appeared to be from Greece's vocal anarchist movement, police told AFP.

On the first day of his visit, Obama also touched on issues that have shaken Greek society -- a dramatic influx of migrants fleeing war and poverty and a crippling financial crisis.

He lauded the people's "extraordinary compassion" for the hundreds of thousands of people who have landed on Greek shores since the start of Europe's worst migrant crisis since World War II.

And he pledged support for its economy, as Greek leaders seek a fresh US pledge to help alleviate the country's enormous public debt, a measure actively sought by the International Monetary Fund but opposed by leading European lender Germany.

"In my message to the rest of Europe, I will continue to emphasise our view that austerity alone cannot deliver prosperity," Obama told Greek Prime Minister Alexis Tsipras.

Agence France-Presse contributed text to this report.

From PRI's The World ©2016 PRI