By Caitlin Ostroff and Gunjan Banerji

U.S. stocks bounced higher after two consecutive days of declines.

Investors had recently put the brakes on what had been a furious rally in stocks in recent weeks, leaving the major indexes hovering near records. Some of the caution toward stocks eased on Wednesday, as stocks edged higher and recouped some of their losses.

After a sluggish start to the day, the S&P 500 rose 0.9% as of the 4 p.m. ET close of trading. The tech-heavy Nasdaq Composite added 1.2%. The Dow Jones Industrial Average gained 318 points, or 0.9%, to 34139.

Some analysts said the recent stretch of declines was a healthy pause for stocks.

"I think that the market will continue to grind higher," said Mike Lewis, head of U.S. equities cash trading at Barclays.

Investors are also closely monitoring earnings to see if the current valuations of expensive stocks can be justified. Chipotle Mexican Grill is among companies that will post results after the New York closing bell.

"We expect earnings to surprise on the upside, but the risks are asymmetric. In an environment where markets are at record highs, any company that doesn't deliver is really punished," said Luca Paolini, chief strategist at Pictet Asset Management. "Over the next few months the direction of earnings will determine the direction of the market."

That was on display Wednesday. Netflix was the biggest loser in the S&P 500 after the company said subscriber growth for the first quarter was weaker than expected. The company's shares fell around 7%.

Still, declines in shares of Netflix and other tech giants like Facebook were outweighed by gains in shares of more cyclical companies like cruise-operators and retailers. And some analysts have said these groups can continue to outperform. JPMorgan Chase strategists said in a note to clients on Tuesday that they expect cyclical sectors like energy and financials stocks to perform well.

Norwegian Cruise Line was one of the best performers in the S&P 500 on Wednesday, adding 8.4%. Carnival advanced 5%.

In bond markets, the 10-year U.S. Treasury yield edged up to 1.571%, from 1.562% on Tuesday. Yields rise as prices fall.

Still, a new wave of Covid-19 infections is sweeping through a number of countries including India and Japan, raising the prospect of fresh hurdles to the anticipated global economic rebound. Health authorities are also warning that new variants may emerge that are resistant to the existing batch of coronavirus vaccines.

"There are still risks in this market, particularly as it relates to the vaccine rollout and virus mutations," said Shoqat Bunglawala, head of international multiasset investments at Goldman Sachs Asset Management. "We're still likely to be in an environment with some volatility."

Overseas, the pan-continental Stoxx Europe 600 ticked 0.7% higher after its biggest one-day drop since late December.

In Asia, most major stock indexes closed lower. Japan's Nikkei 225 fell 2%, while Hong Kong's Hang Seng declined 1.8%. The Shanghai Composite Index ended the day relatively flat.

Write to Caitlin Ostroff at caitlin.ostroff@wsj.com and Gunjan Banerji at Gunjan.Banerji@wsj.com

(END) Dow Jones Newswires

04-21-21 1617ET