Investors cheered a tentative US-Mexico trade deal and sent stocks to record highs.

Both the S&P 500 and the Nasdaq closed at all-time highs on Monday, and the Nasdaq topped 8,000 for the first time. The Dow spiked 259 points and finished above 26,000 for the first time since February 1.

The deal would rewrite parts of NAFTA, the three-country trade deal. US Trade Representative Robert Lighthizer said he expects Canada to sign on.

The agreement would require that 75% of the parts in any car sold in North America be produced in the United States or Mexico to be exempt from tariffs. The existing threshold is 62.5%.

It would also require that 40% to 45% of auto parts in cars sold in North America be made by workers earning at least $16 per hour. Those rules could give American plants an advantage over Mexican plants, where workers make far less.

The announcement gave a lift to a market that has fretted about trade wars for months. US automakers recorded even bigger gains. GM (GM) stock shot up almost 5%, and Ford (F) climbed more than 3%.

The president has called NAFTA the worst trade agreement in American history. Representatives from the three countries began to renegotiate the agreement about a year ago.

— CNN's Kevin Liptak and Jeremy Diamond and CNNMoney's Julia Horowitz, Chris Isidore and Katie Lobosco contributed to this report.