QUEBEC CITY, QC - JUNE 08:  Prime Minister of Canada Justin Trudeau (R) speaks with U.S. President Donald Trump during the G7 official welcome at Le Manoir Richelieu on day one of the G7 meeting on June 8, 2018 in Quebec City, Canada. Canada will host the leaders of the UK, Italy, the US, France, Germany and Japan for the two day summit, in the town of La Malbaie.  (Photo by Leon Neal/Getty Images)
Leon Neal/Getty Images
QUEBEC CITY, QC - JUNE 08: Prime Minister of Canada Justin Trudeau (R) speaks with U.S. President Donald Trump during the G7 official welcome at Le Manoir Richelieu on day one of the G7 meeting on June 8, 2018 in Quebec City, Canada. Canada will host the leaders of the UK, Italy, the US, France, Germany and Japan for the two day summit, in the town of La Malbaie. (Photo by Leon Neal/Getty Images)
Now playing
01:58
US and Canada reach deal on NAFTA
Canadian Prime Minister Justin Trudeau (L) and U.S. President Donald Trump pose for photographs at the White House October 11, 2017 in Washington, DC. The United States, Canada and Mexico are currently engaged in renegotiating the 25-year-old North American Free Trade Agreement.  (Chip Somodevilla/Getty Images)
Chip Somodevilla/Getty Images
Canadian Prime Minister Justin Trudeau (L) and U.S. President Donald Trump pose for photographs at the White House October 11, 2017 in Washington, DC. The United States, Canada and Mexico are currently engaged in renegotiating the 25-year-old North American Free Trade Agreement. (Chip Somodevilla/Getty Images)
Now playing
01:44
Trump says he rejected meeting with Trudeau
Now playing
02:04
Trump announces new US-Mexico trade deal
justin trudeau ac360 031218
justin trudeau ac360 031218
Now playing
01:36
Trudeau on NAFTA: Focused on working together
Photo Illustration: CNNMoney/Getty Images/Shutterstock
Now playing
02:16
China retaliates after new US tariffs
Now playing
03:59
Land O'Lakes CEO: Farmers need answers on trade
Element Electronics/YouTube.com
Now playing
03:25
US company says it was crippled by Trump's tariffs
Now playing
01:26
WSJ: Trump to impose tariffs on $200B in goods
Now playing
01:45
How the US trade war might impact your beer
Courtesy Ford
Now playing
02:06
Ford won't bring this car to the US
TOPSHOT - US President Donald Trump (L) and China's President Xi Jinping leave a business leaders event at the Great Hall of the People in Beijing on November 9, 2017.
Donald Trump urged Chinese leader Xi Jinping to work "hard" and act fast to help resolve the North Korean nuclear crisis, during their meeting in Beijing on November 9, warning that "time is quickly running out". / AFP PHOTO / Nicolas ASFOURI        (Photo credit should read NICOLAS ASFOURI/AFP/Getty Images)
NICOLAS ASFOURI/AFP/AFP/Getty Images
TOPSHOT - US President Donald Trump (L) and China's President Xi Jinping leave a business leaders event at the Great Hall of the People in Beijing on November 9, 2017. Donald Trump urged Chinese leader Xi Jinping to work "hard" and act fast to help resolve the North Korean nuclear crisis, during their meeting in Beijing on November 9, warning that "time is quickly running out". / AFP PHOTO / Nicolas ASFOURI (Photo credit should read NICOLAS ASFOURI/AFP/Getty Images)
Now playing
01:56
Can the US win a trade war with China?
Now playing
03:04
China is killing my business. Now tariffs are too
Scott Olson/Getty Images North America/Getty Images
Now playing
02:55
Trump's trade war threatens Midwest farmers
Head-On
CNN
Head-On
Now playing
01:28
Trump: Working toward zero tariffs with EU
Josh Rogin newday 06292018
CNN
Josh Rogin newday 06292018
Now playing
01:40
CNN analyst: US allies are freaked out
(CNN) —  

Canada agreed late Sunday to sign on to a trade deal between the United States and Mexico, revamping the three-country North American Free Trade Agreement after more than a year of tortuous negotiations.

Just hours before a midnight deadline, the US and Canadian governments agreed to a deal that would allow US farmers greater access to Canada’s dairy market and address concerns about potential US auto tariffs, officials from both countries said.

The agreement with Canada and Mexico — two of the United States’ biggest trading partners — fulfills President Donald Trump’s campaign pledge to renegotiate NAFTA and avoids his threat to exclude Canada if the talks failed.

The new deal has a new name: the United States-Mexico-Canada Agreement.

“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,” said US Trade Representative Robert Lighthizer and Canadian Foreign Affairs Minister Chrystia Freeland in a joint statement.

Trump praised the agreement early Monday as a “great deal” for all three countries that would expand markets for American farmers and manufacturers.

“The USMCA is a historic transaction!” he said on Twitter.

But some experts questioned whether the changes to NAFTA were worth the strain put on relations with Canada by Trump’s threats and brinkmanship during the negotiations.

“We have really hurt relationships with our major ally … for the sake of a few gallons of milk,” Jeffrey Rosensweig, a business professor at Emory University, said on CNN.

Negotiators from the three countries spent all weekend working over the phone, hoping to keep the nearly 25-year-old deal alive.

Earlier in the evening, Trump was briefed on the nearly finalized negotiations by Lighthizer and White House adviser Jared Kushner.

The Trump administration plans to send the new deal to Congress, starting a 60-day review period before Trump can sign it. Congress can suggest changes during that time.

Ahead of the weekend’s talks, several lawmakers had warned that they would not support a deal without Canada.

“It would be a monumental mistake to do this without Canada,” US Senator Ron Wyden of Oregon, the top Democrat on the Senate committee that oversees trade, said Friday, before the text was delivered. “It’s basically surrendering on fixing NAFTA.”

The Trump administration has been working to sign a new trade deal before Mexican President Enrique Peña Nieto leaves office on December 1. To meet that deadline, the text of the agreement had to be submitted to Congress before October.

Negotiators from the three countries began talks about updating NAFTA more than a year ago. Trump had campaigned on renegotiating or ripping up the trade pact, calling it “the worst deal maybe ever signed.”

In August, the United States and Mexico resolved an issue over auto manufacturing, but several sticking points with Canada remained. Trump wanted Canada to open its dairy market to US farmers, and Canada wanted to preserve a mechanism for resolving disputes.

Those goals were achieved in the deal reached late Sunday, according to a Canadian official with knowledge of the negotiations.

The access to Canada’s dairy market will closely mirror what was given under recently negotiated agreements between Canada and the European Union and a separate one with Pacific countries, the Canadian official said.

Canada and Mexico are the United States’ two biggest export markets. A deal that left one of them out could cause chaos for businesses that rely on trade between the countries.

The US Chamber of Commerce has said it would be “unacceptable to sideline Canada, our largest export market in the world.”

Vehicles, machinery and agricultural products make up much of the goods traded between the countries.

“We have a level playing field with Canada and Mexico, and we have for the last quarter century that NAFTA has been in place,” said Rosensweig of Emory University. “This changes nothing. It’s just a political move.”

Katie Lobosco and Sherisse Pham contributed to this report.