(CNBC) — The S&P 500 and Nasdaq composite rose and hit record highs on Monday after a rise in tech and energy stocks.

The S&P climbed 0.4 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.

Note: Read our discussion guidelines before commenting.