U.S. stocks shot up, while oil prices also jumped, as investors parsed testimony on the Federal Reserve’s plans to raise interest rates and watched for updates from Ukraine.

The S&P 500 rose 80.28 points, or 1.9%, to 4386.54, a day after the benchmark index fell 1.6%. The Dow Jones Industrial Average gained 596.40 points, or 1.8%, to 33891.35 and the technology-focused Nasdaq Composite Index added 219.56 points, or 1.6%, to 13752.02.

Wednesday’s...

U.S. stocks shot up, while oil prices also jumped, as investors parsed testimony on the Federal Reserve’s plans to raise interest rates and watched for updates from Ukraine.

The S&P 500 rose 80.28 points, or 1.9%, to 4386.54, a day after the benchmark index fell 1.6%. The Dow Jones Industrial Average gained 596.40 points, or 1.8%, to 33891.35 and the technology-focused Nasdaq Composite Index added 219.56 points, or 1.6%, to 13752.02.

Wednesday’s advances were broad-based, with 10 of the S&P 500’s 11 sectors rising 1% or more. Five rose more than 2%.

Despite the continuing war in Ukraine and surging oil prices, investors were focused on interest rates. Fed Chairman Jerome Powell, appearing before the House Committee on Financial Services, said he would propose a quarter-percentage point rate increase at the central bank’s meeting in two weeks. That alleviated concerns on Wall Street that the Fed would raise rates by half a percentage point.

Yields on benchmark 10-year Treasury notes rose to 1.862%, from 1.708% Tuesday, the largest one-day yield gain since March 18, 2020. Yields and bond prices move in opposite directions.

Stocks have been volatile in recent days as investors have tracked escalations in the war waged by Russia in Ukraine as well as domestic news about the economy and inflation.

Investors are responding to fast-moving developments on the battlefield, a volley of Western sanctions on Moscow and major companies cutting ties with Russia. By boosting energy prices, the conflict has added to uncertainty regarding likely path of U.S. interest-rates this year.

Wednesday’s gain marked the S&P 500’s sixth move of more than 1%—in either direction—in the past seven sessions, said Frank Cappelleri, the executive director of brokerage Instinet. Those kinds of whipsaw moves reflect a fragile market, he said.

“We haven’t seen big moves like this in two years,” he said, referencing the early days of the pandemic.

Major U.S. indexes have been relatively resilient since the Russian invasion of Ukraine, with the S&P 500 up 3.8% and Nasdaq up 5.5%. However, soaring oil prices threaten to unleash more volatility across markets, and equities are still in an overall downswing dating back to last year, Mr. Cappelleri said.

Moreover, some current market trends—like oil driving other assets or rising interest rates—haven’t been seen in years or decades, he noted. “Very few investors have lived through a rising-rates environment,” said Mr. Cappelleri.

Rising oil prices pose a headache for central banks already dealing with the fastest inflation rates in decades.

Energy markets extended their rapid advance Wednesday. U.S. crude prices surged over $110 a barrel for the first time since 2014 as refiners refused to buy Russian oil, taking a bite out of global energy supplies. U.S. crude settled up 7% at $110.60. It has gained 21% over the past three sessions, its biggest three-day percentage gain since May 18, 2020.

Conflicts like Russia’s invasion of Ukraine have historically sent stock prices lower and boosted the value of certain commodities. WSJ’s Dion Rabouin explains the investor psychology that is moving markets. Photo: Justin Lane/EPA-EFE/Shutterstock

“The knock-on effects [across markets] are heavily dependent on how high oil prices get,” said

Craig Erlam, senior market analyst at Oanda. “If oil prices start to head to $120, we’re going to start seeing a lot more talk about the economic consequences globally of these sanctions.”

The financial sector was the top performer in the session, up about 2.6%, erasing about half of its losses from earlier in the week. Berkshire Hathaway rose 2.2% to $323.64, JPMorgan gained 2.1% to $139.28, Bank of America was up 1.6% to $43.16 and Wells Fargo rose 3.8% to $52.22.

The energy sector rose 2.2%. Energy companies stand to benefit from higher energy prices, even as they work to disentangle themselves from Russia. Exxon said this week it would halt operations at a multibillion-dollar oil and gas project in Russia and would make no further investments in the country.

Exxon Mobil rose 1.7% to $80.53, Chevron moved higher 3% to $154.14, and ConocoPhillips added 1.1% to $98.04.

Among other corporate names, shares of Nordstrom

jumped 38% to $26.93 after the retailer projected stronger-than-expected earnings this year. Hewlett Packard Enterprise raised its earnings forecast for the year, lifting shares 10% to $16.99.

In Europe, the pan-continental Stoxx Europe 600 rose 0.9%. In Russia, stocks and derivatives trading was closed for a third day this week. The Russian ruble fell 0.7% against the greenback to trade at 111.25 per U.S. dollar, versus 83 Friday.

Prices leapt in other pockets of the energy market tied to Russia. European natural-gas prices jumped 37%. There has so far been minimal disruption to the pipeline system in Ukraine, through which about a third of Russian gas exports to Europe flow, according to analysts.

The Organization of the Petroleum Exporting Countries and its Russia-led allies agreed Wednesday to raise their collective production by another 400,000 barrels a day in April, in line with what was agreed to last year. This came after the U.S. and other major oil-consuming nations said they would release 60 million barrels of oil from their emergency stockpiles.

The International Energy Agency said it wanted to send “a unified and strong message to global oil markets that there will be no shortfall in supplies as a result of Russia’s invasion of Ukraine.”

Traders have dialed back expectations for the number of Federal Reserve interest-rate rises this year.

Photo: Michael Nagle/Zuma Press

In the cryptocurrency market, bitcoin settled Wednesday at $43,950, according to Dow Jones Market Data, up 0.2%. Russia’s invasion of Ukraine has increased demand for cryptocurrencies in both countries, helping drive up the price of bitcoin.

Stocks in Asia mostly fell. Japan’s Nikkei 225 lost 1.7% and Hong Kong’s Hang Seng Index finished down 1.8%. South Korea’s Kospi, in contrast, added 0.2%.

Write to Paul Vigna at Paul.Vigna@wsj.com, Joe Wallace at joe.wallace@wsj.com and Caitlin McCabe at caitlin.mccabe@wsj.com