US President Donald Trump has touted the newly reached trade deal with Canada and Mexico that will replace NAFTA as a massive job engine.

He said the new deal would create positions across the manufacturing, agriculture, technology and financial services sectors.

"These measures will support many - hundreds of thousands -American jobs," he said at a news conference at the White House.

"It means far more American jobs, and these are high-quality jobs."

The three countries came to the final deal, which Mr Trump called the "most modern, up-to-date and balanced trade agreement" in US history, late yesterday evening. Mr Trump said he plans to sign it by the end of November.

Mr Trump said the deal would give US farmers greater access to export wheat, poultry, eggs and dairy, while also turning North America into a "manufacturing powerhouse" and ensuring higher wages for car workers.

He also said that Mexico and Canada have agreed to labour, intellectual property and environmental provisions in the new agreement.

Mr Trump said the NAFTA rewrite would not have been reached without tariffs, adding that, even though possible tariffs have given the United States strong trade leverage, the country may not need to use them.

The last-minute deal rescues a three-country, $1.2 trillion open-trade zone that had been about to collapse after nearly 25 years.

In a big victory for his agenda to shake-up an era of global free trade that many associate with the signing of NAFTA in 1994, Mr Trump coerced Canada and Mexico to accept more restrictive commerce with their main export partner.

"The agreement will govern nearly 1.2 trillion (dollars) in trade, which makes it the biggest trade deal in the United States history," he said.

Mr Trump's primary objective in reworking NAFTA was to bring down US trade deficits, a goal he has also pursued with China, by imposing hundreds of billions of dollars in tariffs on imported goods from the Asian giant.

While the new US-Mexico-Canada Agreement (USMCA) avoids tariffs, it will make it harder for global car makers to build cars cheaply in Mexico and is aimed at bringing more jobs into the US.

Since talks began more than a year ago, it was clear Canada and Mexico would have to make concessions in the face of Mr Trump's threats to tear up NAFTA.

In a joint statement, Canada and the US said it would "result in freer markets, fairer trade and robust economic growth in our region".

Outgoing Mexican President Enrique Pena Nieto hailed the deal as "the achievement of what we proposed from the beginning: a win-win-win agreement".

Ildefonso Guajardo, his economy minister, said negotiators had held firm in the face of Mr Trump's threats to axe what the US President called "the worst deal ever signed".

The Trump administration "thought they could do and undo a lot of things without really understanding the benefits," he said. "They were thinking the unthinkable. Fortunately, that rhetoric diminished over time."

Negotiators worked frantically ahead of a midnight US imposed deadline to settle differences, with both sides making concessions to seal the deal.

The US and Mexico had already clinched a bilateral agreement in August.

"It's a great win for the president and a validation for his strategy in the area of international trade," a senior US administration official told reporters.

The deal will preserve a trade dispute settlement mechanism that Canada fought hard to maintain to protect its lumber industry and other sectors from US anti-dumping tariffs, US and Canadian officials said. 

But it came at a cost. Canada has agreed to provide US dairy farmers access to about 3.5% of its approximately $16 billion annual domestic dairy market. 

Although Canadian sources said its government was prepared to offer compensation, dairy farmers reacted angrily.

The deal also requires a higher proportion of the parts in a car to be made in areas of North America paying at least $16 an hour, a rule aimed at shifting jobs from Mexico. 

Canada and Mexico each agreed to a quota of 2.6 million passenger vehicles exported to the US in the event that Trump imposes 25% global car tariffs on national security grounds. 

The quota would allow for significant growth in tariff-free automotive exports from Canada above current production levels of about 2 million units, safeguarding Canadian plants. 

It is also well above the 1.8 million cars and SUVs Mexico sent north last year. 

But the deal failed to resolve US tariffs on Canada's steel and aluminium exports. 

The Trump administration had threatened to proceed with a Mexico-only trade pact as US talks with Canada foundered.

The news delighted financial markets that had fretted for months about the potential economic damage if NAFTA blew up.

The Canadian dollar also surged to its highest since May against the US dollar, gaining around 0.5%. The Mexican peso has gained 0.8% to its highest against the dollar since early August.