NEW YORK (Reuters) - The S&P 500 and the Nasdaq edged up to record closing highs for the third consecutive session as investors struggled over whether to take profits following a rally on positive developments in trade disputes which have vexed the markets.

Following a United States-Mexico agreement Monday to overhaul the North American Free Trade Agreement (NAFTA), focus shifted to Canada, with its top trade negotiator joining her Mexican and U.S. counterparts in Washington in a bid to remain in the trilateral pact.

The Dow Jones Industrial Average also closed marginally higher in a late summer, low-volume session of back-and-forth trading as investors debated whether to cash in or ride the market’s momentum.

“My vote is on the side of momentum,” said Jim Bell, president, chief investment officer at Bell Investment Advisors in Oakland, California. “Business leaders are quite confident. They’re irritated by the trade challenges but it looks to me as if all systems are go.”

Technology companies led the advance, offset by declines in energy .SPNY, telecom .SPLRCL and materials .SPLRCM sectors, among others.

Luxury retailer Tiffany & Co TIF.N reported better-than-expected second-quarter results and raised its full-year profit forecast. The stock closed up 1.0 percent.

Sears Holding Corp SHLD.O stock surged by 12.6 percent as its Auto Center partnership with Amazon.com Inc AMZN.O expanded, its services now available nationwide. The partnership was first announced in May.

Slideshow ( 3 images )

Yum China Holdings Inc YUMC.N rose 3.9 percent following a Wall Street Journal report that the fast food operator rejected a buyout.

The Dow Jones Industrial Average .DJI rose 14.38 points, or 0.06 percent, to 26,064.02, the S&P 500 .SPX gained 0.78 points, or 0.03 percent, to 2,897.52 and the Nasdaq Composite .IXIC added 12.14 points, or 0.15 percent, to 8,030.04.

Of the 11 major sectors of the S&P 500, four ended the session in positive territory, with real estate .SPLRCR and technology posting the biggest percentage gains.

Among losers, shares of Best Buy Co Inc BBY.N sank 5.0 percent after the electronics retailer reported a drop in online sales growth and provided underwhelming third-quarter profit guidance.

Campbell Soup Co CPB.N closed 2.1 percent lower after a New York Post report that the soup maker does not plan to sell itself.

Tesla Inc TSLA.O stock extended its decline, falling 2.3 percent in the wake of Chief Executive Elon Musk's decision to abandon his take-private scheme. Separately, broker Canaccord Genuity said it expects the electric automaker to miss its Model 3 production targets.

Declining issues outnumbered advancing ones on the NYSE by a 1.13-to-1 ratio; on Nasdaq, a 1.02-to-1 ratio favored decliners.

The S&P 500 posted 43 new 52-week highs and one new low; the Nasdaq Composite recorded 100 new highs and 27 new lows.

Volume on U.S. exchanges was 5.58 billion shares, compared with the 6.18 billion average for the full session over the last 20 trading days.