(Reuters) - A broad-based rally pushed the S&P 500 and the Nasdaq to record-high closes for the second straight session on Monday as a trade agreement reached between the United States and Mexico buoyed investor sentiment.

Technology stocks led the Nasdaq above the 8,000 mark for the first time and the sector provided the biggest boost to the S&P 500.

A senior U.S. trade official announced a deal with Mexico to replace the North American Trade Agreement and said talks with Canada were expected to begin immediately.

The upbeat trade outlook was further boosted by news that Washington was pressuring the European Union to accelerate tariff talks.

Disputes between the United States and its trading partners have been a drag on investor sentiment for much of the year despite solid economic fundamentals and two robust quarters of corporate earnings.

“It takes a long time for people to come out of the concerns related to those thousand-point down days and feel a little bit more comfortable,” said Robert Pavlik, chief investment strategist at SlateStone Wealth LLC in New York. “And the trade concerns and the tariffs, that played a part in it, that’s what held it back.

“People are feeling a little bit more positive,” Pavlik added.

Slideshow ( 6 images )

Matt Blunt, president of the American Automotive Policy Council, said he was optimistic about the trade deal. Shares of Ford Motor Co F.N were up 3.2 percent while General Motors GM.N rose 4.8 percent.

Tariff-sensitive companies Boeing Co BA.N and Caterpillar Inc CAT.N were up 1.2 percent and 2.8 percent, respectively, leading the industrial sector's advance and pulling the Dow higher.

The Mexico-focused iShares MSCI Mexico ETF EWW.N was up 2.1 percent.

The Dow Jones Industrial Average .DJI rose 259.29 points, or 1.01 percent, to 26,049.64, the S&P 500 .SPX gained 22.05 points, or 0.77 percent, to 2,896.74 and the Nasdaq Composite .IXIC added 71.92 points, or 0.91 percent, to 8,017.90.

Of the 11 major sectors of the S&P 500, nine ended the session in positive territory, with the biggest percentage gains in materials .SPLRCM, financials .SPNY and industrials .SPLRCI.

Defensive utilities .SPLRCU and real estate .SPLRCR sectors were the only percentage losers.

Slideshow ( 6 images )

Tesla Inc TSLA.O stock dipped 1.1 percent, paring earlier losses following news that Chief Executive Elon Musk was scrapping his scheme to take the electric automaker private.

Chipotle Mexican Grill CMG.N was the biggest percentage loser in the S&P 500, down 4.8 percent after Wedbush downgraded the burrito chain's shares.

Luxury retailer Tiffany & Co ended the session down 1.3 percent ahead of its second-quarter earnings report expected early on Tuesday.

Advancing issues outnumbered declining ones on the NYSE by a 1.80-to-1 ratio; on Nasdaq, a 1.29-to-1 ratio favored advancers.

The S&P 500 posted 54 new 52-week highs and no new lows; the Nasdaq Composite recorded 159 new highs and 31 new lows.

Volume on U.S. exchanges was 6.19 billion shares, compared with the 6.27 billion average over the last 20 trading days.