The United States and Canada agreed to a deal to replace the North American Free Trade Agreement shortly before a midnight deadline.

The 24-year-old NAFTA, which President Donald Trump railed against as a disaster, will be replaced by the USMCA — the United States-Mexico-Canada Agreement.

Trump tweeted his approval Monday morning for what he called a "wonderful" trilateral agreement.

Tweet1

Tweet2

Tweet3

In a joint statement, U.S. Trade Representative Robert Lighthizer and Canadian Foreign Affairs Minister Chrystia Freeland said the agreement "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 plan is for the leaders of the three North American countries to sign before the end of November, after which it would be submitted to Congress.

The negotiations between American and Canadian officials involved offering more market access to U.S. dairy farmers, as well as Canada agreeing to an arrangement effectively capping automobile exports to the United States.

A senior Trump administration official said the deal will "re-balance our trade relationship with Mexico and Canada," highlighting new rules on the origin of autos, and market access to Canada's dairy sector.

The deal will also modernize what was covered by NAFTA by adding provisions on digital trade and intellectual property, the administration official said.

A U.S. official also pointed to the prospect of enforcing the agreement, calling it "one of the most enforceable trade agreements we've ever had."