"This has been a battle, and battles sometimes make great friendships", Trump said at the start of the signing ceremony.
He called the deal by its old name NAFTA, prodded Trump over U.S. steel and aluminium tariffs, and said General Motors Co's decision to cut production and slash its North American workforce, including in Canada, was a "heavy blow".
"Donald, it's all the more reason why we need to keep working to remove the tariffs on steel and aluminum between our two countries", Trudeau said.
Trump, Prime Minister Justin Trudeau and outgoing Mexican President Enrique Pena Nieto signed an authorization for the deal on Friday morning in Buenos Aires on the sidelines of the Group of 20 summit, with their ministers signing it shortly after.
Canada's milk producers say Canada has surrendered its ability to independently manage its dairy system with the signing of the updated North American free-trade agreement on Friday.
The farmers say the final text of the trilateral agreement, announced on September 30 and signed by leaders of the three countries at the G20 summit in Buenos Aires, grants the trading partners a say in the running of Canada's dairy system, eroding Canadian sovereignty while giving up new market access. While the Canadian government finally agreed to a deal in early October, it has objected to the Trump administration's protectionist steel and aluminum tariffs.
'The new agreement will assure a new prosperity, ' he added.
Canadian Prime Minister Justin Trudeau was truer to the nature of the deal in his remarks at the signing, saying it "maintains stability", "lifts the risk of serious economic uncertainty" and secures the duty-free access to markets achieved under NAFTA.
The deal - 32 chapters, 11 annexes and 12 side letters - sets new rules for the auto sector, including a higher threshold for North American content and rules requiring that 40 per cent of vehicle parts be made by workers paid at least $16 an hour.
The president bluntly addressed the periodically rocky relations during the signing ceremony, asserting: "We've worked hard on this agreement".More news: Boozman, recipient of Saudi largesse, a no vote on ending Yemen war
More news: German Chancellor Merkel's aircraft makes emergency en route to G20 summit
More news: Oil prices drop amid rising USA stocks, OPEC uncertainty
The side letters left unchanged the overall quota of autos (2.6 million units annually for each country) and auto parts (US$108-billion for Mexico and $32.4-billion annually for Canada) that the countries will be allowed to send to the United States without paying a potential 25-per-cent tariff.
Mexican President Pena Nieto, on his last day in office, called the revamped version of NAFTA important in shoring up "the view of an integrated North America with the firm belief that together we are stronger and more competitive".
It was unclear what exactly the three countries have signed.
The opposition Democrats take control of the House in January.
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. Trump, who has repeatedly denied any prior dealings with Russian Federation, in his tweet again mocked the investigation led by special counsel Robert S. Mueller III as a "Witch Hunt!"
Pena Nieto said the new deal will provide a more "modern framework" for future exchanges between the countries.
Congress can suggest small changes to be made to the legislation without sending the three parties back to the negotiating table.
Trump had forced Canada and Mexico to renegotiate the 24-year-old agreement because he said the existing pact encouraged USA companies to move jobs to low-wage Mexico. "Instead, we have a deal that locks in numerous old rules that have driven farmers out of agriculture for more than two decades".