Canada late Sunday agreed to a new trade deal with the United States and Mexico that would replace the 24-year-old North American Free Trade Agreement (NAFTA), and tempering, at least for now, relations that had soured between Ottawa and Washington.

In a joint statement, U.S. Trade Representative Robert Lighthizer and Canadian Foreign Affairs Minister Chrystia Freeland said the United States-Mexico-Canada Agreement (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.”

It was unclear when the new agreement, which Congress must ratify, would take effect. President Trump said Monday that he planned to sign USMCA “by the end of November. I then will submit it for approval to Congress where, in theory, there should be no trouble — but anything you submit to Congress is trouble, no matter what.”

Lawmakers from both parties expressed relief that a deal was clinched with Canada at the last minute. There had been little enthusiasm on Capitol Hill for an agreement that excluded Canada, and three powerful business groups — the U.S. Chamber of Commerce, the Business Roundtable and the National Association of Manufacturers — also opposed excluding Ottawa. Mexico and the United States reached a bilateral trade deal at the end of August.

“This trade pact will provide our farmers and ranchers with much needed export market certainty and will strengthen the relationship with two of our most important trading partners,” said Sen. Pat Roberts (R-KS), adding that he was “eager to review the details.”

Sen. Sherrod Brown’s (D-OH) office said it would be at least 60 days before any final deal could be signed by Trump, Canadian Prime Minister Justin Trudeau and, presumably, Mexico’s outgoing president, Enrique Peña Nieto. “Several additional steps” must also take place before Congress, which is currently controlled by Republicans, votes on the agreement.

“This is an important first step forward, and I’m glad all three countries worked together to reach an agreement,” Brown said. “We still have more work ahead of us before anything is final, and I will continue working with the administration as we craft legislation needed to implement an updated NAFTA.”

Mexico’s president-elect, Andrés Manuel López Obrador, takes office on Dec. 1.

Some reports speculated USMCA could go into effect in 2020, but Mexico’s economy minister told Reuters that it could be by the second half of 2019.

USMCA includes a provision calling for Canada and the United States to recognize Mexico’s “direct, inalienable and imprescriptible ownership of hydrocarbons” within its territory, including the continental shelf.

It also includes a provision to settle trade disputes between the three nations, which appears in-line with the investor-state dispute settlement (ISDS) provision of NAFTA, which the oil and gas industry was eager to preserve. ISDS protects U.S. investors, including oil and gas companies, from unfair treatment or asset seizures by host nations.

According to the American Petroleum Institute (API), USMCA continues market access for natural gas and oil products produced in the United States with zero tariffs. It also requires that Mexico retain at least its current level of openness to U.S. energy investment, and allows additional flexibility for U.S. customs authorities to accept alternative documentation to certify that natural gas and oil have originated in Canada or Mexico upon entering the United States.

API CEO Mike Sommers urged Congress to approve the USMCA.

“Having Canada as a trading partner and a party to this agreement is critical for North American energy security and U.S. consumers,” Sommers said. “Retaining a trade agreement for North America will help ensure the U.S. energy revolution continues into the future.”

Last week, President Trump lashed out at Canada and threatened to enact a tariff on auto imports if Ottawa didn’t join the trade agreement with Mexico. Trump also claimed that he rejected a one-on-one meeting with Trudeau over the trade impasse, but a Trudeau spokesman denied a meeting was requested.