The Dow Jones industrial average rose on Friday as Wall Street booked a week of solid gains following a strong rally in energy stocks. The Dow also posted a seven-day winning streak.

The 30-stock index closed 91.64 points higher at 24,831.17 with Verizon and Merck as the best-performing stocks. Meanwhile, the gained 0.2 percent to close at 2,727.72 as telecommunications and health care outperforming. The Nasdaq composite closed just below breakeven at 7,402.88.

For the week, the Dow rose 2.3 percent — its biggest weekly gain since March — while the S&P 500 and Nasdaq climbed 2.4 percent and 2.7 percent.

Energy stocks led the way for the major indexes this week, climbing 3.8 percent. The sector received a boost from surging oil prices, which jumped after President Donald Trump pulled the United States out of the Iran nuclear deal.

"Energy is going to lead the market," said Marc Chaikin, CEO of Chaikin Analytics. "I don't think the current price of oil is pricing in the full ramifications of the Iran deal."

Back in 2015, the Obama administration and Iran signed a deal to defer sanctions on Iranian oil exports, while Iran curbed its nuclear program. On Tuesday, Trump said the U.S. was pulling out of that deal and restoring sanctions.