U.S. stocks edged higher Wednesday, trying to extend their recent winning streak, as investors weighed strong earnings reports from technology companies against weak economic reports.

The Dow Jones Industrial Average was most recently up 0.3%. The S&P 500 added 0.6% as traders tried to push the index to a fourth straight day of gains. The index gained 5.1% in the three prior sessions.

The...

U.S. stocks edged higher Wednesday, trying to extend their recent winning streak, as investors weighed strong earnings reports from technology companies against weak economic reports.

The Dow Jones Industrial Average was most recently up 0.3%. The S&P 500 added 0.6% as traders tried to push the index to a fourth straight day of gains. The index gained 5.1% in the three prior sessions.

The Nasdaq Composite was up 0.2%. The tech-heavy index had risen more than 1% earlier in the session, buoyed by a surge in profit from Google parent Alphabet, but struggled to maintain those gains.

Stocks have staged a recovery in recent days after suffering their worst month since the pandemic began. Signals from Federal Reserve officials about plans to tighten monetary policy faster than previously expected to fight inflation weighed on sentiment and prompted a selloff in growth stocks.

“The focus has clearly turned to earnings. We’ve seen strong results from big tech companies. But at some point, we might have sentiment turning back to macro data and the Fed—we think we will oscillate between these two points,” said Luc Filip, head of investments at SYZ Private Banking. “For financial markets, this means more volatility.” 

With earnings season about halfway through, the number of companies that have beaten Wall Street’s expectations on sales and profit is above average, although lower than earlier in the recovery, according to an analysis from Deutsche Bank.

Corporate earnings have been good enough, but that is being weighed against not only the Fed’s change in monetary policy, but the fact that the central bank is hiking in an economy that looks soft, said Barclays Capital managing director Maneesh Deshpande. “Both those things are a problem right now,” he said. “Earnings may not save the day this time.”

Shares of Alphabet, Google’s parent company, rose 8% after profit rose by a third in the last quarter. The search giant also unveiled plans for a 20-for-1 stock split. Chip maker Advanced Micro Devices gained 6.1% after it reported revenue and a sales outlook above analysts’ forecasts, also sending shares of Xilinx, a semiconductor firm it is planning to acquire, up 5.6%.

“This has helped turn things around. It reminds people that earnings growth isn’t just about the future and tomorrow’s gravy. Some of these companies are delivering today,” said John Roe, head of multiasset funds at Legal & General Investment Management. Investors are buying the dip after the Nasdaq entered correction territory last month, falling more than 10% from its recent high, he added.

PayPal tumbled 26%, on track for its worst one-day performance on record, after the company posted lower earnings and higher expenses and scrapped an ambitious growth strategy. It’s a stark reversal from the past two years, when PayPal was an investor favorite, given the rise in pandemic-induced online shopping.

PayPal shares are trading at their lowest level since May 2020 and other consumer-facing stocks were down as well. Square parent Block declined 11% and Starbucks fell 0.9% after it said rising costs will continue to weigh on its profits in the months ahead.

Traders worked on the floor of the New York Stock Exchange on Tuesday.

Photo: Allie Joseph/Associated Press

Alphabet gained about $115.8 billion in market cap on Wednesday, a little more than twice as much as PayPal lost ($52.9 billion). Because Alphabet is in the S&P 500’s communication services sector, its gains have made that sector the index’s strongest on the day, up nearly 4%. In fact, the sector has risen almost 11% over the past five sessions, including Wednesday, its best five-day stretch since 2009, according to Dow Jones Market Data.

Meta Platforms, formerly known as Facebook, Spotify, T-Mobile US and Qualcomm are scheduled to report results after markets close. 

The yield on the benchmark 10-year Treasury note ticked down to 1.749% from 1.799% on Tuesday. 

Oil prices slipped after Wednesday’s OPEC meeting, where major producers stuck to their plan of moderate output increases. Some in the group are already struggling to deliver their quotas, which will likely support prices, analysts said. U.S. crude fell 0.2% to $88.06 a barrel. 

The nonfarm private sector in the U.S. lost about 301,000 jobs in January, according to a release from ADP. Economists were expecting an increase. Data on the labor market has been mixed in recent days, with a report on Tuesday showing that job openings rose and the quit rate remained high in December. 

Overseas, the pan-continental Stoxx Europe 600 climbed 0.5%. In Asia, Chinese markets were closed for the Lunar New Year holiday. Japan’s Nikkei 225 climbed 1.7%, buoyed by strong earnings reports from financial firm Nomura and electronics company Keyence.

Write to Anna Hirtenstein at anna.hirtenstein@wsj.com and Paul Vigna at Paul.Vigna@wsj.com