(For a live blog on the U.S. stock market, click or type LIVE/ in an Eikon news window)

* U.S., Mexico reach trade deal; Canada talks imminent

* Energy, materials stocks rise as commodity prices gain

* Best Buy slides on weak online sales, Q3 profit forecast

* Cosmetics firm Coty, chipmaker Xilinx up on broker upgrades

* Indexes up: Dow 0.22 pct, S&P 0.17 pct, Nasdaq 0.15 pct (Updates to open)

By Shreyashi Sanyal

Aug 28 (Reuters) - U.S. stock indexes rose on Tuesday, with the benchmark S&P 500 and the Nasdaq indexes hitting fresh all-time highs, as a trade agreement between the United States and Mexico calmed fears of a global trade war.

While the trade-sensitive industrial sector rose 0.24 percent, the gains were led by commodity-related stocks, with metal and energy companies gaining as prices of Brent crude and metals rose.

The United States and Mexico agreed to overhaul the North American Free Trade Agreement, putting pressure on Canada to remain part of the three-nation pact.

Canadian Foreign Minister Chrystia Freeland is expected to travel to Washington for talks on Tuesday and U.S. Treasury Secretary Steve Mnuchin told CNBC that he believed a deal could be reached this week.

Also helping sentiment was news from the White House that U.S. President Donald Trump and German Chancellor Angela Merkel “strongly supported ongoing discussions” on trade.

“The markets have been on fire and are being fueled by economic optimism and the fears of tariffs have been subsiding,” said Andre Bakhos, managing director at New Vines Capital LLC in Bernardsville, New Jersey.

“Trump is getting things done like he had promised and the markets like that because it removes the uncertainty of a trade war,” Bakhos added.

At 9:50 a.m. EDT the Dow Jones Industrial Average was up 57.86 points, or 0.22 percent, at 26,107.50, the S&P 500 was up 4.91 points, or 0.17 percent, at 2,901.65 and the Nasdaq Composite was up 11.95 points, or 0.15 percent, at 8,029.84.

Eight of the 11 major S&P 500 sectors were higher, led by the materials sector’s 0.45 percent gain, followed by the energy sector’s 0.49 percent rise.

The defensive sectors dropped with the telecom services sector down 0.12 percent and the utilities sectors off 0.1 percent.

Best Buy slid 8 percent, the most on the S&P, after the electronics retailer’s quarterly online sales growth slowed and its current-quarter profit forecast missed estimates.

Coty rose 7.2 percent, the most on the S&P, and Estee Lauder gained 2 percent after Morgan Stanley upgraded the shares of the beauty products makers.

Xilinx gained 2.9 percent, leading gainers on the Nasdaq 100, after Baird upgraded the chipmaker’s shares on a expected ramp-up in 5G-related shipments later this year.

Campbell Soup fell 2.3 percent after a New York Post report that the soup maker does not plan to sell itself.

Advancing issues outnumbered decliners for a 1.72-to-1 ratio on the NYSE and a 1.39-to-1 ratio on the Nasdaq.

The S&P index recorded 33 new 52-week highs and no new lows, while the Nasdaq recorded 59 new highs and 10 new lows. (Reporting by Shreyashi Sanyal in Bengaluru; Editing by Shounak Dasgupta)