U.S. stocks closed higher on Wednesday, led by energy and financials, as investors parsed through a slew of economic data while watching surging oil prices.
"We think the market is getting accepting that rates are going to go higher," said Thomas Wilson, senior investment manager at Brinker Capital. "It's interesting because the market was at a point where good news was seen as bad by the market. I think the market is driving away from that, and that's good."
The S&P 500 rose 0.4 percent, with financials and energy gaining more than 1 percent to lead advancers. The Nasdaq rose approximately 0.5 percent.
"There is just very bullish sentiment, ironically, right after Brexit," said Anna Rathbun, director of research for CBIZ Retirement Plan Services. "Utilities, telecoms and staples have been underperforming in the second half."
The SPDR S&P 500 Bank ETF (KBE) rose around 2 percent and posted its best day since August 5, when it gained 3.21 percent.
U.S. crude futures settled 2.34 percent higher at $49.83 per barrel, its highest level since June., supported by a bullish inventories data. The Energy Information Administration said Wednesday that U.S. crude inventories decreased by 3 million barrels, marking the fifth straight week of declines.
"Oil's been on a tear for a while and this consecutive beat in inventories is really fueling those oil and energy names," said Mariann Montagne, senior investment analyst at Gradient Investments. "This is carrying into the [broader stock] market."
Oil prices had risen earlier in the session, after the American Petroleum Institute said on Tuesday afternoon that U.S. oil inventories had decreased by 7.6 million barrels.