A tug-of-war between good news on commodity markets and bad news for the U.S. economy sent stocks veering wildly between heavy losses and mild gains on Wednesday. 

On the one hand, crude oil rebounded from a two-day selloff, surging nearly 8% to close at session highs. 

On the other, the services sector, one of the largest segments of the economy, saw growth slow to its weakest level in two years. 

Investors didn't know what to make of the conflicting news. The S&P 500 closed 0.5% higher, the Dow Jones Industrial Average climbed 183 points or 1.1%, and the Nasdaq fell 0.28%. But, earlier in the session, benchmark indexes tumbled more than 1%.

Services activity, which includes retail and health care, slipped to 53.5 in January on the Institute for Supply Management's gauge, its slowest pace since February 2014. The reading suggested that weakness in the manufacturing and energy sectors has spread over to the services portion of the economy.

The possibility of further rate hikes from the Federal Reserve this year, despite recent weakness in the data, also unsettled investors. 

"We do expect the Fed to continue on with subsequent rate hikes despite clear evidence of weakness," said Lindsey Piegza, chief economist at Stifel. "We expect the Fed to exacerbate the spread between what the Fed should do -- continue to coddle the U.S. economy -- and what the Fed will do -- continue on with additional rate hikes this year."

Comments from central bank officials during the past two days offered mixed messages. Kansas City Fed President Esther George noted on Tuesday that recent weakness and volatility in the market has not undermined the Fed's confidence in the U.S. economic recovery. 

Meanwhile, New York Fed president Bill Dudley noted that financial conditions have tightened since December, the month in which the central bank raised rates for the first time in nearly a decade. Dudley said continued tightening in the U.S. economy would influence the Fed's decisions on future hikes.

Weaker data on the spending habits of consumers punished the discretionary and tech sectors. Discretionary consumer stocks tumbled, among them Netflix (NFLX - Get Report ) , Starbucks (SBUX - Get Report) and Priceline (PCLN - Get Report) . The Consumer Discretionary SPDR ETF (XLY) fell 1.7%. Meanwhile, tech stocks such as Amazon (AMZN - Get Report) , Alphabet (GOOGL) , Netflix (NFLX - Get Report) and Microsoft (MSFT) were sharply lower.

Exclusive Look Inside: Starbucks and Alphabet are holdings in Jim Cramer's Action Alerts PLUS charitable trust portfolio. Want to be alerted before he buys or sells them? Learn more now.

It was a sunnier picture for commodities as crude oil bounced even after weekly inventories rose for their fourth week in a row. Domestic stockpiles rose by 7.8 million barrels, roughly double estimates. Prices have been under pressure as worries about oversupply persist and hopes for production cuts from Russia and the Organization of Petroleum Exporting Countries faded. West Texas Intermediate crude oil gained 8.7% to $32.48 a barrel.

The energy sector was one of the best performers on Wednesday. Exxon Mobil (XOM) , PetroChina (PTR) , Royal Dutch Shell (RDS.A) , BP (BP) , Total (TOT) , and Schlumberger (SLB) climbed, while the Energy Select Sector SPDR ETF (XLE) added 1.3%.

The private sector added 205,000 jobs in January, according to the ADP national employment report, a sign that the labor market continues to show resilience. The official read on nonfarm payrolls will be out on Friday morning. Economists expect 192,000 jobs to have been added to the U.S. economy and the unemployment rate to hold steady at 5%.

"Job growth remains strong despite the turmoil in the global economy and financial markets," said Mark Zandi, chief economist of Moody's Analytics. "Manufacturers and energy companies are reducing payrolls, but job gains across all other industries remain robust. The U.S. economy remains on track to return to full employment by mid-year."

Chipotle (CMG) fell more than 4% after missing quarterly estimates by a wide margin as it continues to suffer from the fallout of an E.coli outbreak. The burrito chain earned $2.17 a share, well below expectations of $3.84 a share. Nevertheless, Chipotle plans to open at least 220 new restaurants this year.

Mondelez (MDLZ)  , also a holding in Cramer's Action Alerts PLUS portfoliofell more than 8% after its sales outlook for 2016 came in at half estimates. The company anticipates organic sales growth of at least 2% compared with consensus estimates of 4%. The snacks company also missed quarterly earnings estimates.

"We knew that this quarter would be messy, and are slightly disappointed by the 2016 organic sales growth outlook," Cramer and Jack Mohr, research director of Action Alerts PLUS, wrote in a note to clients. "That said, sentiment was extremely low heading into the quarter given the myriad headwinds" such as a one-time charge on its Venezuelan operations and currency exchange challenges.

Merck (MRK) shares fell after the drugmaker issued a softer outlook for fiscal 2016 as some of its key treatments, including Remicade for inflammatory diseases, see weaker sales growth. The company expects full-year sales no higher than $40.2 billion, below consensus of $40.3 billion.