NEW YORK (Reuters) - The S&P 500 ended lower on Wednesday as gains in technology stocks were offset by a drop in healthcare shares, and investors parsed mixed messages over prospects for a deal to end a trade war between the United States and China.

Technology shares led the Nasdaq higher while the Dow Jones Industrial average posted a nominal loss.

U.S. stocks struggled for direction throughout the session as market participants pondered whether a planned meeting between U.S. President Donald Trump and Chinese President Xi Jinping at the Group of 20 summit in Japan would yield any progress in the two country’s protracted tariff dispute.

The market initially perked up after U.S. Treasury Secretary Steven Mnuchin was quoted by CNBC interview as saying the trade deal between the United States and China is “about 90%” complete. His comments were later restated to show he was using the past tense to describe progress in the talks.

Trump later said that while it was “absolutely possible” to avoid imposing additional tariffs on imported Chinese goods, he was “very happy where we are now.”

“(Trade) optimism has been unwound as the day has gone on,” said Robert Pavlik, chief investment strategist at SlateStone Wealth LLC in New York.

“Last week the market had a clear path of what to focus on: A rate cut in July and Trump and Xi meeting at the G20 to discuss reopening trade negotiations,” Pavlik added. “What has happened since is this government has muddied the waters and confused the market.”

FILE PHOTO: Traders work on the main trading floor after the opening bell at New York Stock Exchange (NYSE) in New York, U.S. June 20, 2019. REUTERS/Brendan McDermid/File Photo

The Dow Jones Industrial Average fell 11.4 points, or 0.04%, to 26,536.82, the S&P 500 lost 3.6 points, or 0.12%, to 2,913.78 and the Nasdaq Composite added 25.25 points, or 0.32%, to 7,909.97.

A rise in crude prices boosted energy stocks. Energy and tech companies were the biggest percentage gainers among the 11 major sectors of the S&P 500, while defensive utilities, real estate and consumer staples saw the largest losses.

Chipmakers led the tech rally. The Philadelphia SE Semiconductor index rose 3.2% after Micron Technology Inc posted upbeat results and forecast a recovery in chip demand. Micron’s shares jumped 13.3%.

Apple Inc shares advanced 2.2% after the iPhone maker confirmed that it bought self-driving startup Drive.ai and after Trump suggested in an interview that the European Union was out of line with its lawsuits against U.S. tech firms, saying that the United States was the one that should be taking action.

EU antitrust regulators on Wednesday hit Broadcom with demands that the chipmaker drop its exclusivity clauses with TV and modem makers as part of its ongoing investigation. Nevertheless, Broadcom’s shares gained 1.8%

General Mills Inc was the biggest percentage loser on the S&P 500, dropping 4.5% after the packaged food company missed quarterly sales estimates, hit by lower snacks demand in North America.

In economic news, new orders for non-defense capital goods rose more than economists expected in May, suggesting some stabilization in business spending, which had shown signs of weakness amid trade jitters and bloated inventories. But overall orders for durable goods dropped, driven by a 28.2% plunge in non-defense aircraft orders, partly due to Boeing’s move to cut production of its troubled 737 MAX aircraft.

Advancing issues outnumbered declining ones on the NYSE by a 1.08-to-1 ratio; on Nasdaq, a 1.03-to-1 ratio favored decliners.

The S&P 500 posted 7 new 52-week highs and 4 new lows; the Nasdaq Composite recorded 21 new highs and 94 new lows.

Volume on U.S. exchanges was 6.69 billion shares, compared to the 6.99 billion average for the full session over the last 20 trading days.