(Reuters) - Wall Street ended higher on Monday after a choppy session, with gains in Apple and other technology stocks offsetting worries about an escalating trade war between Washington and its trading partners.

Microsoft Inc MSFT.O, Facebook Inc FB.O and Apple Inc AAPL.O each rose 1 percent or more, pushing the S&P 500 information technology index .SPLRCT up 0.99 percent, bringing gains for the year-to-date to 11 percent as investors bet on strong earnings from Silicon Valley in the approaching quarterly reporting season.

“It doesn’t look like tech is going to slow down this year,” said Jake Dollarhide, chief executive officer of Longbow Asset Management in Tulsa, Oklahoma. “The tech play is here to say.”

Traders were also eyeing the July 6 deadline for U.S. tariffs on $34 billion worth of Chinese goods to kick in, which pose the danger of a strong response from Beijing.

The European Union has warned the United States that imposing import tariffs on cars and car parts would likely lead to counter-measures on $294 billion of U.S. exports, while Canada has vowed to take punitive measures in response to U.S. steel and aluminum tariffs.

“These tit-for-tat trade tariffs will ultimately raise prices for consumers and will likely dampen demand for products,” said Jack Ablin, chief investment officer at Cresset Wealth Advisors in Chicago.

Ablin said he expected strong U.S. corporate earnings for the quarter ended in June, but that profits for the rest of 2018 were in danger of being hurt by an escalating trade war.

Only three of the 11 main S&P 500 sectors ended lower on Monday, with energy .SPNY down 1.55 percent on the back of a 2 percent drop in Brent crude LCOc1.

Wall Street suffered steep losses at the start of the session, but reversed course later.

Traders work on the floor of the New York Stock Exchange (NYSE) in New York, U.S., June 28, 2018. REUTERS/Brendan McDermid

The Dow Jones Industrial Average .DJI rose 0.15 percent to end at 24,307.18 points, while the S&P 500 .SPX gained 0.31 percent to 2,726.71. The Nasdaq Composite .IXIC added 0.76 percent to 7,567.69.

On Tuesday, U.S. stock exchanges will close at 1 p.m. EDT (1700 GMT) ahead of the Fourth of July holiday, when the exchanges will also be closed. With some investors already taking time off on Monday, volume on U.S. exchanges was 6.2 billion shares, compared with the 7.3 billion average over the last 20 trading days.

Also helping the market was Commerce Department data that showed U.S. construction spending increased 0.4 percent in May, more than estimated, amid gains in investment in private and public construction projects.

The Institute for Supply Management said national factory activity surged last month, likely as steel and aluminum tariffs disrupted supply chains, resulting in factories taking longer to deliver goods.

Tesla Inc TSLA.O fell 2.3 percent after the electric car maker said it hit its target of producing 5,000 Model 3 sedans per week. Many investors were skeptical about the financial impact of ramping up production and the quality of the cars being built. In addition, just before the market close, Tesla said its chief engineer was leaving the company.

Shares of casino companies fell as gambling revenue in the Chinese territory of Macau rose less than expected in June.

Wynn Resorts WYNN.O sank 7.89 percent, while Las Vegas Sands LVS.N fell 6.67 percent after Bank of America downgraded the stock. MGM Resorts MGM.N dropped 3 percent.

Dell Technologies took a step closer to becoming a public company again with a deal to buy the tracking stock of its majority-owned VMware unit. The VMware tracking stock DVMT.N jumped 9 percent, while VMware VMW.N gained 10.24 percent.

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

The S&P 500 posted two new 52-week highs and 11 new lows; the Nasdaq Composite recorded 52 new highs and 70 new lows.