President Donald Trump talks with reporters before departing on Marine One for the Air Force Academy graduation ceremony in Washington. Picture: Evan Vucci/AP

Washington - President Donald Trump on Thursday announced a 5-per-cent tariff on all goods imported from Mexico to pressure the country into stopping illegal immigrants from entering the US.

In a statement, Trump said Mexico's "passive cooperation" with the flow of illegal immigration was an "emergency and extraordinary threat to the national security and economy of the United States."

The tariff will be imposed on June 10 and be raised to 10 per cent on July 1 "if the crisis persists," Trump added.

The tariff will then be gradually increased "if Mexico still has not taken action to dramatically reduce or eliminate the number of illegal aliens crossing into the the United States."

Mexican President Andres Manuel Lopez Obrador called for dialogue in a letter to Trump written after the announcement, saying that the social issues driving migrants to the US "cannot be fixed with tariffs or coercive measures."

Lopez Obrador said Trump's "America First" narrative was a fallacy as he called for in-depth discussions about the reasons behind migration.

"And please, remember that I don't lack courage, that I am not cowardly or timorous but I act on principles," the Mexican president said, adding "nothing by force, all for reason and the law."

Trump has frequently expressed frustration over a growing number of migrants at the US border with Mexico. He has threatened to shut down the border with his southern neighbour entirely and declared a national emergency to obtain funding to build a wall along the border.

Mexican trade negotiator Jesus Seade said the tariffs were "disastrous."

"The threat turned into action is serious, very serious, extremely serious," television station Foro TV quoted Seade as saying.

Shoppers wait in line at a Sam's Club in Mexico City. The Trump administration announced Thursday it will impose tariffs on steel and aluminium imports from Europe, Mexico and Canada after failing to win concessions from the American allies. Mexico retaliated quickly saying it would penalize US imports including pork bellies, apples, grapes, cheeses and flat steel. Picture: Marco Ugarte/AP

The Mexican government would not "sit idle until June 10," he said, adding: "but I trust that this is something that will not actually happen as it would be extremely serious."

Trump's surprise announcement came as the Mexican Senate received the updated free trade deal between the US, Mexico and Canada for ratification.

Meanwhile, US Vice President Mike Pence was in Canada for talks with Prime Minister Justin Trudeau discussing the deal. Canada has also started the ratification process this week.

It was not immediately clear if the updated trade deal would be affected by Trump's move.

Mexico is a key trading partner for the US, with trade worth 671 billion dollars last year.

It is not the only country to have faced hard-ball tactics from the US president. China has been embroiled in a trade war with the US for the past year after Trump began applying tariffs to hundreds of billions of dollars worth of goods.