U.S. stocks fluctuated before closing slightly higher on Wednesday as investors processed data on global manufacturing, U.S. auto sales and inflation for clues about the Federal Reserve's next interest rate hike.
The Nasdaq eked out a gain to close higher for a sixth straight session.
Global manufacturing activity remained stuck in a rut last month with factory output from Asia, Europe and the Americas barely improving, surveys released on Wednesday showed.
But major U.S. stock indexes recovered from declines during the session after a report showed U.S. manufacturing grew for a third straight month in May. Stocks also improved as oil prices pared losses.
A fuller picture of the economy will come with Thursday's ADP employment report and Friday's payrolls data.
"There’s an abundance of economic data this week that investors are confused on how to digest," said Jonathan Corpina, senior managing partner for Meridian Equity Partners in New York.
The Dow Jones Industrial Average rose 2.47 points, or 0.01 percent, to 17,789.67, the S&P 500 gained 2.37 points, or 0.11 percent, to 2,099.33 and the Nasdaq Composite added 4.20 points, or 0.08 percent, to 4,952.25.
Seven of 10 S&P sectors ended higher, while telecoms were the worst performers. The healthcare sector tallied its sixth straight day of gains.
U.S. auto sales weakened in May, with General Motors, Ford Motor and other manufacturers reporting lower U.S. sales. GM shares fell 3.4 percent while Ford dropped 2.8 percent.
Inflation pressures grew slightly across most of the United States from April to mid-May, the Fed said in an anecdotal report. The report could make the central bank more comfortable that inflation is on track to rise back to the Fed's 2-percent target.
The Fed caught investors off guard last month when it signaled its next rate hike could be just weeks away. It next meets on June 14-15.
The S&P 500 is coming off a third straight month of gains, its first such streak in two years. The benchmark index is up more than 2 percent in 2016 after a rough start to the year amid jitters about the global economy and a volatile oil market.
On Wednesday, shares of Michael Kors rose 6.6 percent, to $45.55 after the luxury accessories maker posted its strongest quarterly sales growth in a year.
Demandware soared 55.9 percent to $74.81. Salesforce.com agreed to buy the company in a $2.8 billion deal. Salesforce fell 0.3 percent.
About 6.5 billion shares changed hands on U.S. exchanges, below the roughly 7 billion daily average for the past 20 trading days, according to Thomson Reuters data.
NYSE advancing issues outnumbered decliners 1,985 to 1,012, for a 1.96-to-1 ratio on the upside; on the Nasdaq, 1,763 issues rose and 1,063 fell for a 1.66-to-1 ratio favoring advancers.
The S&P 500 posted 21 new 52-week highs and 1 new low; the Nasdaq recorded 70 new highs and 25 new lows.