By Agence France-Presse
The Dow Jones Industrial Average gained 0.7 percent to 26,651.21.
The broad-based S&P 500 advanced 0.4 percent to 2,924.59, while the tech-rich Nasdaq Composite Index shed 0.1 percent to 8,037.30.
After months of wrangling, Canada and the United States overcame their differences after both sides conceded some ground to reach a three-way deal with Mexico.
The deal boosted market sentiment, which has taken a hit this year as President Donald Trump has launched a number of attacks on international trade agreements.
"Some of the downside risk has probably been alleviated," said Matthew Miskin of John Hancock Investments.
But stocks finished well below their session highs, a nod to worries about higher oil prices, tightening Federal Reserve monetary policy and data suggesting slowing growth.
"The market likes to see accelerating growth," Miskin said. "It's a decent backdrop but not as positive as a month or so ago."
General Electric jumped 7.1 percent after announcing it was replacing its chief executive with former Danaher chief H. Lawrence Culp in GE's latest move to try to reverse a two-year slide.
Tesla Motors surged 17.4 percent after Elon Musk reached an agreement with regulators that will allow him to stay chief executive.
Automakers Fiat Chrysler and General Motors climbed 2.7 percent and 1.6 percent following the US-Canada trade agreement. Uncertainty about trading rules has been a major overhang of the auto industry.
Oil giants Chevron and ConocoPhillips won 1.8 percent and 3.2 percent after US oil prices finished at a four-year high.