WTI futures for March delivery, which expired after the settle Monday, ended up $1.84, or 6.21 percent at $31.48 a barrel. The April contract settled up $1.64 at $33.39 a barrel.
The International Energy Agency said in its medium-term outlook Monday that U.S. shale oil production was expected to fall by 600,000 barrels per day (bpd) this year and another 200,000 bpd in 2017. The forecast added to last week's drop in U.S. oil rig count to their lowest level since December 2009, according to Reuters.
"Perhaps today's report would offer investors a little more comfort that the worst is behind us," said Jack Ablin, chief investment officer at BMO Private Bank.
"Certainly the U.S. is the swing producer and seeing the rig count fall certainly leads to this belief that production would fall," he said.
OPEC Secretary General Abdalla Salem El-Badri said at the CERAWeek energy conference in Houston that OPEC is willing to work with non-OPEC producers to find a solution for low oil prices.
Last week, Saudi Arabia and Russia agreed to a production freeze at January levels if other producers participated.
Also helping gains in U.S. stocks Monday was further stabilization in China, where the yuan held steady overnight. The Shanghai composite jumped more than 2 percent to lead gains in Asian equities. European stocks closed more than 1.5 percent higher.
"Any time we get a stable night in China, (that) leads to calmness in Europe, and calmness in those two markets helps here," said Peter Boockvar, chief market analyst at The Lindsey Group.
Over the weekend, China's official Xinhua news agency said Xiao Gang, chairman of the China Securities Regulatory Commission, had been succeeded by Liu Shiyu, chairman of the Agricultural Bank of China and a former deputy governor of the central bank.
Read MoreWhy this could be a pivotal week for markets
The S&P 500 closed up 1.45 percent, within 10 percent of its 52-week intraday high, or out of correction, with energy and consumer discretionary leading advancers. The Nasdaq composite remained in correction territory, or more than 10 percent below its 52-week intraday high.
The third-best S&P advancer was materials, led by gains in Freeport-McMoRan and Alcoa as copper and other industrial metals climbed. Freeport closed up 14.6 percent, while Alcoa rose 13.2 percent.
Materials and energy are the worst two S&P performers for the last 12 months. Gains in the sectors Monday led several analysts to attribute the rally to short covering.
"I don't think this environment's changed in the last week. I think it's sentiment-driven and short covering," said Jonathan Lamensdorf, managing director and portfolio manager at Highland Capital Management.
The rise in copper came after reports of increased Chinese imports last month, but Dane Davis, commodities research analyst at Barclays, attributed much of the gains in copper to a correlation with oil prices rather than fundamentals.
"(The correlation)'s become particularly strong over the last couple weeks," he said. "The lift in crude oil over $30 has resulted in a bullish sentiment and that bullish sentiment has lifted copper."
Read MoreUS oil industry buckling up for biggest production cuts
However, the gains in oil and other commodities supported a risk-on trade as Treasury yields rose and gold prices fell, snapping a three-day win streak.
"I think what's more encouraging is if you see the commodity complex surging that would be driven by a better impression of the global economy," said Art Hogan, chief market strategist at Wunderlich Securities.
In U.S. economic news, the flash read on Markit Manufacturing PMI for February was 51.0, down from the final January print of 52.4 and hitting its lowest since October 2012.
Treasury yields held higher, with the 2-year yield at 0.75 percent and the 10-year yield at 1.76 percent.
The U.S. dollar index traded about 0.8 percent higher. The euro was near $1.10, its lowest against the dollar in nearly three weeks, and the yen at 112.80 yen against the greenback.
Pound sterling held a touch above session lows. Earlier, sterling fell below $1.4100 to its lowest in nearly seven years after popular London Mayor Boris Johnson said he would campaign for Britain to leave the European Union ahead of a June 23 referendum.