U.S. stocks recovered losses to close a touch higher Wednesday, the first trading day of June, helped by an intraday recovery in oil prices and better-than-expected manufacturing data.
The S&P 500 closed higher but below the psychologically key 2,100 level, which it briefly topped in afternoon trade.
"Crude really got us going. The ISM was a sigh of relief," said Jeremy Klein, chief market strategist at FBN Securities.
U.S. crude oil futures settled down 9 cents, or 0.18 percent, at $49.01 a barrel after earlier falling below $48 a barrel.
Reuters reported Wednesday that four OPEC sources said the organization will consider setting a new oil output ceiling at its meeting scheduled for Thursday.
"The ISM number that came out earlier seemed to give a sight of relief to the market. However, the recovery seems to be focused on the defensive sectors," said David Schiegoleit, managing director of investments at U.S Bank Private Client Reserve.
"Traders are taking a cautious tone right now ahead of the bigger releases later this week," Schiegoleit said.
Consumer staples, health care and utilities led S&P 500 advancers, while financials and energy recovered losses to close mildly higher.
The Nasdaq composite posted its first six-day win streak since February 2015. ( Tweet This ) Shares of Costco (COST) rose 2.5 percent for the greatest positive impact on the Nasdaq 100. Goldman Sachs upgraded Costco to "buy" from "neutral." Apple (AAPL) closed 1.4 percent lower for the greatest negative impact.
The major averages came off session lows after the ISM manufacturing PMI for May topped expectations with a 51.3 print. Consensus estimates from Reuters expected a read of 50.5, barely in expansion territory and off slightly from the previous month's report of 50.8.
Klein noted "there was definitely a real fear we were going to move below 50" and the data reinforced expectations for a Fed hike as soon as this summer.
Traders also attributed some of the late-session gains to first-of-month inflows.
The Dow Jones industrial average closed up about 2.5 points after earlier falling 122 points. Apple and IBM were the greatest contributors to declines.
"I think what's causing some of the sell-off (this morning was) questions about the strength of the U.S. economy and the global economy," said Chris Gaffney, president, EverBank World Markets.
The Fed's Beige Book released Wednesday afternoon said there was modest economic growth since the last report. The Beige Book also said tight labor markets were pushing up wages.
The major economic news for the week is the jobs report, scheduled for release Friday morning. Fed Chair Janet Yellen is set to speak on June 6. She is also scheduled to testify to the Senate Banking Committee on June 21, according to an announcement on the committee website.
Treasury yields edged off lows, with the 2-year yield (U.S.:US2Y) higher around 0.89 percent and the 10-year yield (U.S.:US10Y) steady near 1.84 percent. Earlier, both yields hit their lowest in two weeks.
The yen strengthened against the dollar, trading near 109.6 yen. The U.S. dollar index fell half a percent, while the euro was last near $1.119.
The "Japanese prime minister did as expected and delayed the consumption tax increase, but in doing so really raised concerns about global growth," Gaffney said.
"The data shows the U.S. economy is really chugging along. It's slow growth, low inflation," he said.
In other economic news, the final read for May on Markit's manufacturing PMI was 50.7. The flash read was 50.5, down from 50.8 in April.
Read More Data dump to kick off June
May auto sales came in at a 17.45 million seasonally adjusted rate, according to Autodata. That was slightly above expectations for 17.3 million, according to economists polled by Reuters.
April construction spending fell 1.8 percent.
As widely expected, Japanese Prime Minister Shinzo Abe announced overnight a two-and-a-half year delay in a scheduled sales tax increase, putting plans for fiscal reforms on the back burner due to growing signs of economic weakness.
Asian stocks closed lower, with the Nikkei 225 down 1.6 percent and the Shanghai composite off 0.11 percent.
In China, the Markit Caixin manufacturing PMI fell to 49.2 in May, below expectations and down from 49.4 in April, and below the neutral 50.0 value for the 15th-straight month.
The official manufacturing PMI was unchanged from the prior month in May at 50.1. The official services PMI edged lower to 53.1 in May from 53.5 in April.
European stocks closed lower, with the German DAX off about 0.6 percent and the STOXX Europe 600 down nearly 1 percent.
Markit's final euro zone manufacturing PMI was steady at 51.5 in May, unchanged from the flash read and a touch below April's 51.7 print.
The Dow Jones industrial average (Dow Jones Global Indexes: .DJI) closed up 2.47 points, or 0.01 percent, to 17,789.67, with DuPont (DD) leading advancers and Apple the greatest decliner.
The S&P 500 (^GSPC) closed up 2.37 points, or 0.11 percent, at 2,099.33, with consumer staples leading seven sectors higher and telecommunications the greatest laggard.
The Nasdaq (^IXIC) composite closed up 4.20 points, or 0.08 percent, to 4,952.25.
The CBOE Volatility Index (VIX) (^VIX), widely considered the best gauge of fear in the market, traded higher near 14.3 after briefly rising above 15.
About two stocks advanced for every decliner on the New York Stock Exchange, with an exchange volume of 892 million and a composite volume of nearly 3.5 billion in the close.
Gold futures for August delivery settled down $2.80 at $1,214.70 an ounce.
—Reuters contributed to this report.
On tap this week:
7:45 a.m. European Central Bank rate decision
8:15 a.m. ADP employment
8:30 a.m. ECB President Mario Draghi press briefing
8:30 a.m. Initial claims
10:30 a.m. Natural Gas inventories
11 a.m. Oil Inventories
1 p.m. Dallas Fed President Rob Kaplan
3:45 a.m. Chicago Fed President Charles Evans in London
8:30 a.m. Employment report
8:30 a.m. International trade
9:45 a.m. Services PMI
10 a.m. ISM non-manufacturing
10 a.m. Factory orders
12:30 p.m. Fed Governor Lael Brainard at Council on Foreign Relations, DC
1 p.m. Rig count
3 a.m. Cleveland Fed President Loretta Mester
*Planner subject to change.
More From CNBC.com:
- This should have you worried about stocks in June
- A shocker! Your retirement finances may be in better shape than you think
- The 3 reasons you should buy tech stocks now: Analyst
More From CNBC