(Reuters) - Wall Street surged on Wednesday as surging oil prices boosted energy stocks following U.S. President Donald Trump’s decision the previous day to quit a nuclear agreement with Iran.

Gains were broad and volume was high, with all but the utilities and telecom sectors advancing as investors who had moved to the sidelines in recent days ahead of Trump’s decision returned to the market.

“It’s classic ‘buy on the terrible news’,” said Ian Winer, director of trading at Wedbush Securities in Los Angeles, referring to the wider market’s rally. “People had gotten way too nervous about this.”

Trump’s decision for the United States pull out of the international agreement aimed at preventing Iran from obtaining a nuclear weapon was good news for investors betting on a rise in oil prices. Crude hit its highest level in 3-1/2 years as investors bet the U.S. withdrawal would increase risks of conflict in the Middle East and curtail global oil supplies.

The S&P energy index .SPNY jumped 2.03 percent, bringing its gain this quarter to 12.6 percent, more than any other sector.

“The rise in oil is helping energy sector, which is expected to be a pretty big growth sector. A lot of analysts are expecting strong earnings as oil rebounds, and that hasn’t really played out so much early this year,” said Shawn Cruz, senior trading specialist at TD Ameritrade in Chicago.

The Dow Jones Industrial Average .DJI rose 0.75 percent to end at 24,542.54 points, while the S&P 500 .SPX gained 0.97 percent to 2,697.79.

The Nasdaq Composite .IXIC added 1 percent to finish the session at 7,339.91.

The Cboe Volatility Index .VIX, the most widely followed barometer of expected near-term volatility for the S&P 500,

Read more from our friends at Reuters: