The S&P climbed about 0.5 percent, with materials leading advancers. Energy was also among the best performers after a sharp rise in crude prices.
West Texas Intermediate futures spiked 2.11 percent to settle at $48.85 per barrel after the Russian and Saudi energy ministers said the two countries agreed to extend a production cut until March 2018.
"This is a snap-back rally in crude. The rubber band had stretched too long below $55 per barrel; now we're around $50," said Joe Sowin, head of global equity trading at Highland Capital Management.
That said, an increase production from the U.S. could cap energy's gains, said Jason Pride, director of investment strategy at Glenmede. "Our Take: Oil should trade in the $50-70 range as increased demand is met by supply from U.S. share oil producers," Pride said in a note Monday.