NEW YORK (TheStreet) -- Stock markets were besieged by even more volatility on Monday, spending much of the day seesawing the flatline as weaker U.S. economic data overshadowed a rally in crude oil prices.

That changed significantly in the final hour of trading, though, as a surge in energy stocks tipped the scales in market optimists' favor.

The S&P 500 closed up 1.3%, the Dow Jones Industrial Average gained 1.1%, or 195 points, and the Nasdaq added 0.89%.

STOCKS TO BUY: TheStreet Quant Ratings has identified a handful of stocks that can potentially TRIPLE in the next 12 months. Learn more.

Oil prices bounced on Monday, briefly cresting the $50-a-barrel level. West Texas Intermediate crude was up 2.9% to $49.65 a barrel.

Exxon Mobil (XOM) - Get Exxon Mobil Corporation Report was up more than 2% after beating fourth-quarter profit expectations. The biggest energy company in the U.S. earned $1.56 a share over the quarter, 22 cents higher than expected. However, net income fell 21% and revenue was down 20%, highlighting how tanking oil prices have undercut the industry's topline growth.

Chevron (CVX) - Get Chevron Corporation Report , Schlumberger (SLB) - Get Schlumberger NV Report , Halliburton (HAL) - Get Halliburton Company (HAL) Report , and ConocoPhillips (COP) - Get ConocoPhillips Report were also higher, while the Energy Select Sector SPDR ETF (XLE) - Get Energy Select Sector SPDR Fund Report jumped 3.1%.

Solar stocks joined in on the rally among energy stocks. First Solar (FSLR) - Get First Solar, Inc. Report , SolarCity (SCTY) , SunPower (SPWR) - Get SunPower Corporation Report and Trina Solar (TSL) jumped.

The latest data on U.S. factory orders indicated slower-than-expected growth, triggering fears the domestic economy isn't as strong as believed. The January ISM manufacturing index slipped to 53.5 from 55.5, its worst level in a year. Though above the expansion level, the reading was below estimates of 54.5.

TheStreet Recommends

"Manufacturers are beginning to slow activity as we round the corner into 2015," said Sterne Agee chief economist Lindsey Piegza. "After months of robust inventory building, a modest domestic consumer, restrained activity overseas and plummeting oil prices are finally forcing a reduction in production, a declining trend expected to continue for some time."

Consumer spending declined for the first time in 11 months in December, down 0.3% and slightly weaker than an expected 0.2% drop. Personal income gained 0.3% month on month, in line with forecasts.

The data showed "some slowing in economic momentum in December," TD Securities' Millan Mulraine said. "Given the surge in household confidence in recent months this trend should reverse in January, and our expectation is for spending to rebound meaningfully ... which will provide a very strong platform for a resurgence in growth activity this quarter. However, with the inflationary backdrop continuing to weaken, we believe that the Fed will continue to hold the line on rates until September (at the earliest)."

Shake Shack (SHAK) - Get Shake Shack, Inc. Class A Report shares pared some of the explosive gains made after going public on Friday. The burger chain's stock more than doubled to $45.90 in its market debut to levels some economists, including Jim Cramer, felt too high.

RadioShack (RSH) plummeted more than 13% on reports the electronics chain might sell half its stores to Sprint S in a bid to evade bankruptcy. The remaining stores will be closed, according to Bloomberg.

Netflix (NFLX) - Get Netflix, Inc. (NFLX) Report was slightly lower after S&P Ratings lowered its outlook on the streaming giant's bonds. The company had announced a new $1 billion senior note offering earlier in the day.

Intel (INTC) - Get Intel Corporation (INTC) Report jumped 1.8% on news it had agreed to acquire German chipmaker Lantiq Semiconductor. The terms of the deal were undisclosed.

STOCKS TO BUY: TheStreet Quant Ratings has identified a handful of stocks that can potentially TRIPLE in the next 12 months. Learn more.

--Written by Keris Alison Lahiff in New York.