Democrats on Sunday slammed Donald Trump's tactics of threatening punitive tariffs to extract concessions on immigration from Mexico, saying the US president was recklessly endangering ties to a major ally and trade partner.

"What the world is tired of, and what I am tired of, is a president who consistently goes to war, verbal war, with our allies," Senator Bernie Sanders, an independent who caucuses with Democrats, said on CNN's .

"We need a decent relationship with Mexico," added Sanders, who is a candidate for the Democratic presidential nomination in 2020. "We should not be confronting them every other day."

His comments came two days after the US and Mexico, following urgent talks in Washington, reached a deal to avert the 5% tariffs Trump had threatened on all imports from Mexico, a move economists said would have had devastating impact in both countries.

The Mexican side, for its part, agreed to bolster security on its southern border and expand its policy of taking back Central American migrants as the US processes their asylum claims.

Major breakthrough

Trump and his Republican supporters hailed the deal as a major breakthrough, but the Democrats sharply criticised his frequent resort to tariff threats and said many of the Mexican concessions were made months ago.

House Speaker Nancy Pelosi issued a sharply worded statement Saturday saying Trump had "undermined America's preeminent leadership role in the world" by threatening tariffs against Mexico.

"Threats and temper tantrums are no way to negotiate foreign policy," she said.

But Kevin McAleenan, the acting secretary of Homeland Security, insisted that results were what mattered.

"People can disagree with the tactics (but) Mexico came to the table with real proposals," he said on . "We have an agreement that, if they implement, will be effective."

Beto O'Rourke, a former congressman from the border city of El Paso, Texas who is also pursuing the Democratic nomination, was among the critics challenging how much Trump had actually accomplished.

"I think the president has completely overblown what he reports to have achieved," he said on ABC's . "These are agreements that Mexico had already made, in some cases months ago.

"They might have accelerated the timetable, but by and large the president achieved nothing except to jeopardise the most important trading relationship that the United States of America has."

Many lawmakers from border states like Texas - even many Republicans - had expressed grave reservations about the tariff threat, but Republicans, at least, welcomed the outcome.

"In general, Republicans understand that tariffs are attacks on American consumers and we don't want to see them in place long-term, nor do I believe President Trump does," Republican Senator Ron Johnson said on Fox.

That said, the Wisconsin lawmaker added: "I think he used them as leverage in this situation brilliantly."