Follow KDKA-TV: Facebook | Twitter

By: Jeremy Diamond, Kevin Liptak, Paula Newton and Donna Borak, CNN

READ MORE: Dave Matthews Band's Star Lake Show Rescheduled

(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 U.S. and Canadian governments agreed to a deal that would allow U.S. farmers greater access to Canada’s dairy market and address concerns about potential U.S. 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.

(Photo by Leon Neal/Getty Images)

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 U.S. 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.

READ MORE: Former Pine-Richland Head Football Coach Eric Kasperowicz Releases District Letter Detailing Why He Lost Job

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,” Sen. 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 Dec. 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 U.S. 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 U.S. 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.”

MORE NEWS: Rural Hospitals Work To Decrease COVID-19 Vaccine Hesitancy

™ & © 2018 Cable News Network, Inc., a Time Warner Company. All rights reserved.