Stocks closed higher on Monday as technology shares posted a three-day winning streak. However, the major averages closed well off the highs of the day after President Donald Trump tweeted he will be announcing his decision on the Iran deal on Tuesday.

The Dow Jones industrial average ended 94.81 points higher at 24,357.32 after rising as much as 200 points, while the S&P 500 posted a gain of 0.4 percent to 2,672.63. The Nasdaq composite rose 0.8 percent to 7,265.21; it rose as much as 1.1 percent.

Trump — who has railed against the U.S.-Iran nuclear deal signed in 2015 — sent his tweet about the Iran decision at 2:44 p.m. ET. The deal lifts sanctions on Iran in exchange for the Middle Eastern nation curbing its nuclear program.

Tweet

"Oil dove pretty good on that, then energy stocks led us off the highs," said Dave Lutz, head of ETF trading at JonesTrading. Crude fell in after-hours trading after settling 1.5 percent higher.

The major averages were first boosted by strong gains in energy stocks on Monday. The Energy Select Sector SPDR Fund (XLE) rose as much as 2.3 percent before closing 0.1 percent higher.