Mexico has ratified the new North American trade agreement, making the country the first to give it final approval despite recent tension with the US.

The United States-Mexico-Canada Agreement (USMCA) passed in the Mexican Senate with 114 votes in favour and just four against, sending what the economy ministry called "a clear message in favour of an open economy and deepening economic integration in the region."

There was little doubt the new deal would pass easily in Mexico: the one it aims to replace, the North American Free Trade Agreement (NAFTA), has helped turn the country into an exporting powerhouse over the past 25 years.

Opening a debate in the upper house, Senator Veronica Martinez, secretary of the economic committee, called the deal "an important agreement for all Mexicans."

"Our economy has been transformed" by regional free trade, she said.

The three countries signed the agreement on 30 November after a year of thorny negotiations triggered by US President Donald Trump's insistence on replacing NAFTA, which he calls "the worst trade deal ever made."

The new deal largely resembles the original, but establishes new rules for the crucial auto sector, intended to boost US-made content in cars and increase wages for Mexican workers.

President Andres Manuel Lopez Obrador backs the deal, and the right-wing opposition had already said it would join his leftist party, Morena, in voting it through with the required two-thirds majority.

The deal faces a tougher battle in the US Congress, where opposition Democrats have criticised its worker protections, dispute resolution system and other issues.

Still, US Trade Representative Robert Lighthizer said yesterday he was confident there would be progress on ratification in "the next couple of weeks."

In Canada, ratification looks assured - though the government is waiting to move forward until the United States does.

The Mexican Senate froze committee proceedings on the USMCA last week in the wake of a standoff over Donald Trump's threat to impose tariffs on Mexico because of the surge of Central American migrants arriving at the two countries' border.

Mexico managed to negotiate a reprieve from the tariffs - which were due to take effect 10 June - by tightening controls at its southern border and expanding its policy of taking back migrants as their asylum requests are processed in the US.

But some Mexican lawmakers accused the executive branch of caving to President Trump's bullying, and put ratification of the USMCA on hold until Foreign Minister Marcelo Ebrard agreed to testify on the exact extent of the migration deal.

Mr Ebrard assured Congress he had not agreed to Donald Trump's demand for a "safe third country agreement," in which migrants arriving in Mexican territory would have to seek asylum there rather than the US.

Trump has vowed to make Mexico agree to such a deal if he deems progress on the migration issue insufficient after 45 days.

After Mr Ebrard's testimony, the Senate allowed the USMCA to move ahead.

But there were barbs in the Senate over President Trump's apparent willingness to blow up the countries' free-trade relationship.

"We can't go on like this.... Let's not bend over, let's not let ourselves be humiliated by threats and blackmail," said opposition Senator Antonio Garcia of the left-wing PRD party.

Still, he said he was voting for USMCA: "It's not the best deal, but it's the one we've got."

Senator Gina Cruz of conservative opposition party PAN said ratifying the deal enabled Mexico to "send a clear message to the world" that "trade wars don't work."