WASHINGTON – Canada has agreed to join the United States and Mexico in a trade deal that will replace the North American Free Trade Agreement, U.S. and Canadian officials said Sunday night.

“Today, Canada and the United States reached an agreement, alongside Mexico, on a new, modernized trade agreement for the 21st century: the United States-Mexico-Canada Agreement (USMCA)," U.S. Trade Representative Robert Lighthizer and Canadian Foreign Affairs Minister Chrystia Freeland said in a joint statement. "USMCA will give our workers, farmers, ranchers and businesses a high-standard trade agreement that will result in freer markets, fairer trade and robust economic growth in our region."

"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," Lighthizer and Freeland added.

“We look forward to further deepening our close economic ties when this new agreement enters into force," they said in crediting Mexican Economy Secretary Ildefonso Guajardo "for his close collaboration over the past 13 months.”

The U.S. had imposed a deadline of midnight Sunday with Canada to reach a new three-country deal.

The last-minute deal will provide the U.S. with greater access to Canada’s dairy market, an issue that had been considered vital for U.S. dairy manufacturers, a senior administration official told reporters.

The text of the new deal was to be submitted to Congress late Sunday and is expected to be signed by all three countries by the end of November, the official said.

“This is a big win for the United States, Mexico and Canada,” the official said.

In a tweet sent early Monday, President Donald Trump praised the salvaged accord and said it would have a new name.

"We reached a wonderful new Trade Deal with Canada, to be added into the deal already reached with Mexico. The new name will be The United States Mexico Canada Agreement, or USMCA. It is a great deal for all three countries, solves the many deficiencies and mistakes in NAFTA, greatly opens markets to our Farmers and Manufacturers, reduce(s) Trade Barriers to the U.S. and will bring all three Great Nations closer together in competition with the rest of the world. The USMCA is a historic transaction!," Trump tweeted.

Commerce Secretary Wilbur Ross described the new agreement as "a huge deal" during an appearance Monday on Fox Business Network's "Mornings With Maria."

“I think it clearly vindicates President Trump's trade policies because this is fundamental reform and now there is no more NAFTA, there's USMCA," Ross said. "So rest in peace NAFTA."

The new agreement comes just one month after the U.S. and Mexico announced that they had reached a new trade pact to replace NAFTA, which essentially eliminated tariffs on most goods traded among the U.S., Canada and Mexico and made it easier for companies in those three countries to move goods and supplies across their borders

Negotiators for the U.S., Canada and Mexico began talks more than a year ago to replace the 24-year-old agreement, which Trump has repeatedly blasted as “the worst deal ever.”

Canada was a part of the discussions to renegotiate NAFTA when the talks started last year. But the negotiations reached an impasse in late May, and Canada stayed on the sidelines while the U.S. and Mexico continued their talks. After the U.S. and Mexico reached a new deal, Trump indicated he was ready to move forward without Canada if an agreement could not be reached with Ottawa.

Negotiations between the U.S. and Canada appeared to be hopelessly stalled last week, partly because of U.S. demands for access to Canada’s dairy market.

Trump said at a press conference Wednesday that negotiators for the two countries weren’t getting along, and he threatened to slap tariffs on Canadian-made cars. Trump also claimed he had refused to meet with Canadian Prime Minister Justin Trudeau during a U.N. General Assembly in New York last week. A spokesman for Trudeau’s government disputed that a meeting had ever been requested.

But with a U.S.-imposed deadline of reaching a new deal by midnight Sunday, the talks accelerated over the weekend, leading to an 11th-hour deal announced late Sunday.

As part of the new deal, Canada will offer the U.S. greater access to its dairy market than what the U.S. would have achieved through the Trans-Pacific Partnership, a trade treaty Trump withdrew from last year, the senior administration official said.

A dispute resolution process that the U.S. had wanted to scrap but Canada wanted to keep will remain in place The new accord will include an “accommodation” to help shield Canada if Trump follows through on a threat to tax imported vehicles, the official said.

It was not immediately clear what that accommodation would entail, but published reports suggested Canada could be exempt from the auto tariffs if it agrees to limit its auto exports to the U.S.

Other new provisions are changes to the so-called auto rules of origin, which dictate that, to avoid tariffs, a certain percentage of an automobile must be built from parts that originated from countries within the NAFTA region.

Under the new rules, cars must be built with at least 75 percent of parts made in North America, up from 62.5 percent under NAFTA. Also, 40 to 45 percent of an auto will have to be made by workers earning at least $16 an hour.

The new trade deal also includes standards designed to protect intellectual property and trade secrets, tougher labor requirements for Mexico and environmental obligations designed to combat trafficking in wildlife, timber and fish.

The agreement will run for 16 years but will be reviewed after six years and could then be extended for another 16.

More:US, Mexico strike trade deal that could pave the way for an overhaul of NAFTA

More:What is NAFTA? Seven things to know about the North American free trade pact

More:Trump says he rejected a meeting with Canada that Canada says it never requested