U.S. stocks rose Wednesday after several retailers offered investors some optimism for this year’s sales and the release of minutes from the Federal Reserve’s most recent policy meeting signaled few changes in the central bank’s plan to fight inflation.

After briefly opening lower, stock indexes turned green in early trading. The benchmarks moved higher after 2 p.m. ET, when the Fed minutes from earlier this month were released.

The S&P 500 index rose 37.25 points, or 0.9%, to 3978.73. The Nasdaq Composite climbed 170.29 points, or 1.5%, to 11434.74, a reversal from a sharp selloff in tech stocks the day before. The Dow Jones Industrial Average rose for a fourth straight trading day, adding 191.66 points, or 0.6%, to 32120.28.

Consumer-discretionary stocks paced the S&P 500’s gain, rising 3.4%. Several retail companies, including Nordstrom and Express, raised their 2022 forecasts, while others such as Dick’s Sporting Goods indicated business wasn’t getting worse. The brighter outlooks offered investors a welcome change from last week, when Target and Walmart reported disappointing results.  Retailer Nordstrom climbed $2.90, or 14%, to $23.58; apparel company Express jumped 16 cents, or 6.7%, to $2.54, and Dick’s rose $6.90, or 9.7%, to $78.14.

“Some investors were expecting retail Armageddon,” said Matt Peron, director of research at Janus Henderson Investors. “The narrative was that this could be another bruising week. Now the market is having a relief rally around the consumer sector.”

Stocks have had a bumpy start to the week, buffeted by concerns about the Fed tightening monetary policy to combat high inflation and how much of a slowdown it could cause. The S&P 500 is down 17% from its last record high in January and briefly fell into bear-market territory last Friday before paring losses late in the session.

“It’s been really volatile, to say the least. This is linked to the question of recession, whether that’s coming or not. That’s effectively what the market has been pushing and pulling between,” said Fahad Kamal, chief investment officer at Kleinwort Hambros.  

Minutes from the Fed’s May 3-4 meeting, released Wednesday, showed that officials discussed the possibility they would raise interest rates to levels high enough to deliberately slow economic growth as the central bank races to combat high inflation. U.S. durable-goods orders for April increased by 0.4%, a slower pace than economists expected.

The Fed minutes offered few, if any, surprises on officials’ thinking, said Phillip Toews,

chief executive of Toews Asset Management. Wednesday’s rally, which gained strength throughout the afternoon, may reflect more than anything the sentiment that many stocks had already fallen enough—at least for now. “I think we may be in a slight bear market here,” he said.

Stocks enter a bear market when an index such as the S&P 500 drops at least 20% from a recent high.

Stocks have tumbled in 2022 as investors have adjusted to surging consumer prices and the Fed’s response. As interest rates have climbed and the economy’s outlook dimmed, the shares of many companies have looked increasingly expensive, at least relative to their earnings, said Sean O’Hara, president of Pacer ETFs Distributors.

“When one goes up,” Mr. O’Hara said, “the other has to go down.”

The yield on the benchmark 10-year Treasury note fell to 2.746% from 2.758% on Tuesday. It has declined for five of the past six trading sessions. Yields fall when prices rise. 

“The market is pricing the slowdown that will eventually come from the Fed tightening. It also forecasts that inflation in 2023 will slow to much more reasonable levels,” said Antonio Cavarero, head of investments at Generali Insurance Asset Management. 

Government debt tends to perform well during times of slower economic growth, which has led to a stabilization in the bond market in recent days. 

Oil prices climbed, with global benchmark Brent crude rising 47 cents, or 0.4%, to $114.03 a barrel. The U.S. energy secretary said the Biden administration hasn’t ruled out a ban on oil exports to tame domestic fuel prices, Reuters reported.

In individual stocks, Snap shares rose $1.37, or 11%, to $14.16. The Snapchat maker’s stock plunged 43% on Tuesday after it issued a profit warning, citing macroeconomic conditions that have deteriorated faster and further than expected. 

“Clearly there’s been a revaluation of tech valuations. It’s impossible to know how far it goes, but some of these are quality businesses and significantly cheaper than they have been trading recently,” Mr. Kamal said. “If you’re a long-term investor, that’s going to be something of interest.” 

Home builder Toll Brothers rose $3.55, or about 8%, to $48.09 after reporting revenue and profit that beat analysts’ expectations. 

The tech-focused Nasdaq Composite fell 2.3% on Tuesday.

Photo: justin lane/Shutterstock

Overseas, the pan-continental Stoxx Europe 600 edged up 0.6%.

In Asia, major benchmarks were mixed. The Shanghai Composite Index added 1.2%, and Hong Kong’s Hang Seng ticked up 0.3%. Japan’s Nikkei 225 declined 0.3%. 

—Ryan Dezember contributed to this article.

Write to Anna Hirtenstein at anna.hirtenstein@wsj.com and Justin Baer at justin.baer@wsj.com