By Daniel Huang 

U.S. stocks ended slightly higher Wednesday as investors looked for signs that the market can stabilize after its recent swoon.

Stocks had started the U.S. trading day under pressure following widespread declines in Europe amid growing concerns about the strength of the euro-zone economy. But healthy corporate earnings and a belief that the U.S. economy is on a moderate growth path have investors thinking declines in eight out the last 10 trading sessions will ultimately prove short-lived.

The Dow Jones Industrial Average rose 13.87 points, or 0.08%, to 16443.34. The S&P 500 index inched up 0.03 point to 1920.24 and the Nasdaq Composite Index advanced 2.22 points, or 0.05%, to 4355.05.

Viren Chandrasoma, managing director in equity trading at Credit Suisse, said that after an extended period of quiet, the pullback was bound to spook some investors. However, he said the swoon wasn't indicative of broader trouble for U.S. stocks.

"Every time you see some selling, the market bounces right back with a surge of buying," Mr. Chandrasoma said. "Plenty of people are looking to employ cash at these lower levels."

While geopolitical tensions, particularly in Russia and Ukraine, weigh on investor sentiment in Europe, U.S. investors pointed to a strengthening U.S. economy as a reason to buy stocks. Also helping boost appetite for stocks has been a relatively strong second-quarter earnings season and low interest rates.

"Corporate earnings are continuing to come in strong," said Doug Cote, chief market strategist at Voya Investment Management. "At the end of the day, we are still in a bull market."

Shares of Molson Coors Brewing Co. rallied 5.8%, making the stock the top gainer in the S&P 500. The company said its second-quarter profit increased 8.8% as higher pricing helped boost sales.

"Any time you get a geopolitical headline, it tends to dominate trading for 24 hours," said J.J. Kinahan, chief strategist at TD Ameritrade. "As soon as it blows over, you get back to what's really driving the market."

U.S. stocks slid on Tuesday, with the Dow industrials posting their fourth loss in five sessions, amid heightened tensions between Russia and Ukraine.

On Wednesday, some investors were buying as they exited positions made to protect against declines, known as hedges, said Jeff Yu, head of single-stock derivatives trading at UBS AG. He said that Tuesday's dive was likely a result of investors making those types of bets, since the steepest losses were in large-cap stocks, which are typically easier to trade than small-cap stocks and high-yield debt, which have both been under pressure recently.

Gains in U.S. stocks were a contrast to a selloff in Europe that saw the Stoxx Europe 600 index close with a 0.9% decline. Data showed that Italy slipped back into recession and German manufacturing orders surprisingly tanked in June, deepening fears that the euro zone's economic recovery is stalling. Germany's economy ministry said concerns about geopolitics probably held back orders.

"There is a battle between traders focused on non-U.S. economic pains and a positive U.S. economic narrative that is increasingly compelling," said Peter Kenny, chief market strategist at Clearpool Group.

Mr. Kenny pointed to strong earnings and signs of a robust U.S. economy as fundamental factors propping up the market. The Commerce Department reported Wednesday that the U.S. trade deficit narrowed more than expected in June, likely boosting measures of second-quarter economic growth.

"For U.S. investors investing in U.S. equities, the long list of improving economic data is the more powerful theme," he said.

In corporate news, Sprint Corp. shares dropped 19%. The wireless carrier decided Tuesday to abandon its pursuit of T-Mobile US Inc. and replace its chief executive.

21st Century Fox withdrew its bid to buy Time Warner Inc., pushing shares up 3.3%, while Time Warner shares fell 12.9%. Time Warner also reported better-than-expected earnings in the second-quarter.

Walgreen Co. said it would buy the remaining 55% of Switzerland-based Alliance Boots GmbH it doesn't already own and confirmed it would maintain its U.S. headquarters after the merger instead of pursuing a so-called tax inversion. Shares fell 14.3%.

Groupon Inc. shares declined 12.7% after posting a loss that widened in the second quarter and issued disappointing guidance for the current quarter.

The yield on the 10-year Treasury note, which moves inversely to its price, briefly dipped to an intraday low of 2.44%, according to FactSet, matching the lowest yield so far this year, before ending at 2.47%.

Gold futures rose 1.7% to $1,307.70 an ounce, while crude-oil futures fell 0.3% to $97.05 a barrel.

Write to Daniel Huang at daniel.huang3@wsj.com

Credit Suisse (NYSE:CS)
Historical Stock Chart
From Feb 2024 to Mar 2024 Click Here for more Credit Suisse Charts.
Credit Suisse (NYSE:CS)
Historical Stock Chart
From Mar 2023 to Mar 2024 Click Here for more Credit Suisse Charts.