The leaders of the United States, Mexico and Canada signed the UMSCA deal replacing the old NAFTA in a triumph for US President Donald Trump, who insisted on what he said were better conditions for US workers.
The leaders of Mexico, Canada and the United States signed a North American trade pact on Friday after brinkmanship over the final details of the deal continued through the eve of the signing.
They agreed on a deal in principle to govern the more than trillion dollars of mutual trade after a year and a half of acrimonious negotiations concluded with a late-night bargain just an hour before a deadline on September 30.
Since then, the three sides have bickered over the wording and the finer points of the deal and still had not agreed just hours before officials were due to sit down and sign it as the G20 summit kicks off in Buenos Aires.
Legislators from the three countries still have to approve the pact, officially known as the United States-Mexico-Canada Agreement (USMCA), before it goes into effect and replaces the North American Free Trade Agreement (NAFTA).
Canadian Prime Minister Justin Trudeau's spokesman only confirmed his attendance late on Thursday. Before signing the deal he continued to refer to as "the New NAFTA," Trudeau told Trump the two should continue to work together to eliminate steel and aluminium tariffs.
Mexico's President Enrique Pena Nieto joined the ceremony on his last day in office.
Trump had vowed to revamp NAFTA during his 2016 presidential election campaign. He threatened to tear it up and withdraw the US completely at times during the negotiation, which would have left trade between the three neighbours in disarray.
Trump forced Canada and Mexico to renegotiate the 24-year-old agreement because he said the existing pact encouraged US companies to move jobs to low-wage Mexico.
US objections to Canada's protected internal market for dairy products was a major challenge facing negotiators during the talks, and Trump repeatedly demanded concessions and accused Canada of hurting US farmers.
A side letter to the September agreement showed that Trump preserved the ability to impose the threatened 25 percent global tariffs on autos while largely exempting passenger vehicles, pickup trucks and auto parts from Canada and Mexico.