Negotiators from Canada and the United States went down to the wire but were able to reach an agreement on a new free trade pact that will include Mexico, the governments announced late Sunday night.
The United States-Mexico-Canada Agreement (USMCA) updates and replaces the nearly 25-year-old North American Free Trade Agreement (NAFTA), which President Donald Trump had labeled a disaster and promised to cancel.
The rewrite "will result in freer markets, fairer trade and robust economic growth in our region," according to the statement from US Trade Representative Robert Lighthizer and Canada's Foreign Affairs Minister Chrystia Freeland.
"It will strengthen the middle class, and create good, well-paying jobs and new opportunities for the nearly half billion people who call North America home," the joint statement read.
"It's a good day for Canada," Canadian Prime Minister Justin Trudeau said as he left his office.
He said he would have more to say on Monday.
"It is a good night for Mexico, and for North America," Mexican Foreign Minister Luis Videgaray tweeted.
TRT World's Kevin McAleese has more from Washington.
US President Donald Trump had threatened to splinter the nearly 25-year-old NAFTA into a bilateral pact with Mexico and tax Canadian vehicle exports to the US if Ottawa had failed to sign on before a midnight Sunday deadline.
But Trump has approved the "framework" deal with Canada, just days after he sharply criticised Trudeau and his NAFTA negotiating team.
Trump blames NAFTA for the loss of American manufacturing jobs and wants major changes to the pact, which underpins $1.2 trillion in annual trade. Markets fear its demise would cause major economic disruption.
Negotiators from both sides spent two days talking by phone as they tried to settle a range of difficult issues such as access to Canada's closed dairy market and US tariffs.
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, Canadian sources said.
Deal comes at cost
Canada had agreed to provide U.S. dairy farmers access to about 3.5 percent of its approximately $16 billion annual domestic dairy market, the sources said, adding that the Canadian government is prepared to offer compensation to dairy farmers hurt by the deal.
The influential Dairy Farmers of Canada lobby group - which strongly opposes the idea - said in a statement that it insisted "any final NAFTA deal should have no further negative impact on the dairy sector."
Canada also agreed to a quota of 2.6 million vehicles exported to the US in the event that Trump imposes 25 percent global autos tariffs on national security grounds, Canadian and US auto industry sources said.
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.
But the deal failed to resolve US tariffs on Canada's steel and aluminum exports, the Canadian sources said.
"We celebrate the trilateral agreement. The door is closed to the fragmentation of the region," Jesus Seade, President-elect Andres Manuel Lopez Obrador's NAFTA negotiator said on Twitter.
"NAFTA 2 will give certainty and stability to Mexican trade with its partners in North America."
Canadian dollar gains strength
The Canadian dollar hit a four-month high on Monday after the the deal.
The loonie (CAD=D4) strengthened to C$1.2814 per US dollar, reaching its highest level since late May.