Stocks held higher on Monday as crude oil and energy names rallied on high hopes for an extension to a production cap agreement.

The S&P 500 was up 0.39%, the Dow Jones Industrial Average added 0.36%, and the Nasdaq rose 0.4%. The S&P 500 and Nasdaq hit all-time intraday highs earlier in the session. 

Crude oil prices rallied on Monday after energy ministers from Russia and Saudi Arabia surprised by calling for an extension to an oil production cap agreement. 

The ministers called for the current deal among the Organization of the Petroleum Exporting Countries to be extended by nine months, far longer than what analysts had hoped. Speaking in Beijing on Monday, Saudi Arabia's energy minister, Khalid al-Falih, and Russia's Alexander Novak said they wanted the current agreement to continue holding back around 1.8 million barrels of oil from the market each day until the first quarter of 2018. 

"The two ministers agreed to do whatever it takes to achieve the desired goal of stabilizing the market and reducing commercial oil inventories to their five-year average level," the ministers said in a joint statement, "as well as to underscore the determination of oil producers to ensure market stability."

An extension to the OPEC deal will be the main point of conversation when the 13 member countries meet in Vienna on May 25. The current agreement, established last November, is set to expire at the end of June.

"There seems to be a real commitment about reducing the glut from oil powerhouses that are Saudi Arabia and Russia -- the latter being the largest oil producer in the world and the former being the largest exporter," said Fawad Razaqzada, market analyst at Forex.com. "Given the backing of Russia, in my view an agreement will be made. The market clearly expects that, with oil prices making a sharp comeback."

If you liked this article you might like

PayPal CEO Reveals How Silicon Valley Could Repair Its Broken Culture

PayPal CEO Explains How to Create a Great Board in Silicon Valley

Novice Trade: Symantec

Equifax's Massive Data Breach Focuses Attention on Symantec's LifeLock

Massive Equifax Hack Lifts Cybersecurity Stocks