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

Traders work on the floor of the New York Stock Exchange (NYSE) in New York, U.S., May 3, 2018. REUTERS/Brendan McDermid

Gains were broad, 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. “People had gotten way too nervous about this.”

Oil hit its highest level in 3-1/2 years as investors worried that Trump’s decision to withdraw the United States from the international agreement aimed at preventing Iran from obtaining a nuclear bomb would increase risks of conflict in the Middle East and curtail global oil supplies.

The S&P energy index .SPNY jumped 2.2 percent, bringing its gain this quarter to 12.8 percent, more than any other sectors.

“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.

At 2:34 pm ET, the Dow Jones Industrial Average .DJI was up 0.73 percent at 24,536.98 points, while the S&P 500 .SPX had gained 0.97 percent to 2,698.28.

The Nasdaq Composite .IXIC added 0.97 percent to 7,337.66.

Worries lingered that rising oil prices would perk up inflation. The U.S. 10-year Treasury yield US10YT=RR rose to a two-week high

Read more from our friends at Reuters: