The New York Stock Exchange on Wednesday, when fears about Ebola and a global slowdown resulted in a wild day in the stock market. (Spencer Platt/Getty Images)

Investors rocketed from panic to rally during a wild Wednesday for stocks, exposing growing fears of a global economic slowdown that will test the strength of the fragile U.S. recovery.

The market chaos was initially sparked by the financial malaise weakening Europe and Asia and surprising slumps in U.S. spending, but it was worsened by the growing specter of the Ebola outbreak.

The Dow Jones industrial average tumbled to what would have been its worst trading day in three years before rallying to close 173.45 points down, at 16,141.74. A “fear gauge” measuring investor apprehension, the Chicago Board Options Exchange Volatility Index, raced to one of its highest points since the summer of 2012.

The global slide showed no signs of easing Thursday. Asian markets closed sharply down. In Europe, all the arrows were red in midday trading with Britain’s FTSE 100 and the German DAX index both down 1.8 percent. The declines in France, Spain and Italy were even steeper.

For more than a year, Wall Street has appeared unstoppable, unfazed by a tepid economic recovery in the United States and a lingering recession in Europe. Workers watched their 401(k) retirement accounts grow even if their paychecks did not. The climb remained unchecked even as market skeptics warned that stocks were overvalued.

Now analysts increasingly fear that the ride up is coming to an end and that Wall Street is at the beginning of a correction.

“We’ve gone pretty much straight up for five years, and we were due, however painful it is to go through, for a bit of a correction,” said John Canally, an investment strategist and economist at LPL Financial.

He said such a fast rise doesn’t make a big pullback any easier for investors. “It makes you queasy, makes your stomach churn, makes you wish you could change the past,” Canally said.

Stocks cratered early Wednesday, setting the stage for a rocky session: Within half an hour, the Dow had swung up and down more than 500 points. A late rally helped scrub over most of the losses, with the Standard & Poor’s 500-stock index, which had sunk by nearly 3 percent at midday, closing down less than 1 percent.

Unpredicted letdowns in U.S. retail sales, housing and manufacturing spooked investors early. They also remain anxious about whether the Federal Reserve will raise interest rates prematurely — withdrawing its primary tool to grow the economy — while the global economy remains weak. But key Fed officials have indicated that they are in no hurry to hike those rates.

Analysts said a confluence of global misery played an even larger part in triggering the markets’ big whiplash.

Europe’s slide toward recession, mostly unslowed by policymakers, has undermined investor confidence. Markets tumbled in France, Italy and Greece. Even Germany, the euro zone’s golden child, has begun to disappoint, as evidenced by particularly brutal falls in its industrial production and exports.

Critically low inflation in Europe and a loss of momentum in global growth could bolster the value of a dollar, which Fed officials have warned could bruise American exports and the broader economy.

“We’re the best house in a bad neighborhood,” said Heather A. Hughes, a markets contributor for CNBC. “But we’re all interconnected. It’s globalization. Europe affects us [whether] those oceans are there” or not.

Worries over international uneasiness are just as visible in Asia, where most of American investors’ favorite multinationals long ago placed their stakes. A big sales tax bump in Japan, the world’s third-largest economy, has exposed cracks in its fragile recovery.

Japan’s Nikkei stock average tumbled 1.9 percent Thursday, reaching a 41 / 2-month low.

“It’s clear that people are avoiding risks,” Takatoshi Itoshima, chief portfolio manager at Commons Asset Management, told the Reuters news agency. He said investors had started to doubt whether the U.S. economic recovery was strong enough to sustain the Japanese stock market.

And a housing bubble in China, now past its biggest boom days, threatens to hobble it even more.

The global slowdown has helped demand for oil continue its downward slide, with prices for a barrel of the benchmark grade settling in around four-year lows.

Many of the uncertainties driving investors to the exits dealt with worries over international stability.

Fears over the rapid spread of Ebola and news that an infected U.S. health-care worker had flown aboard a busy jet led to a sell-off of airlines. And investors continue to show growing unease over the crisis in Ukraine, gathering tensions with Russia and the military campaign against the Islamic State in Iraq and Syria.

Investors fled stocks for the refuge of safer government bonds, sending yields on 10-year U.S. Treasurys below 2 percent for the first time in 16 months. Those yields, which can influence consumer loans and mortgages, also recovered slightly.

Rocky global growth prospects and a swelling dollar, analysts said, could lead the stock market to continue its slide. But some said it was not yet a collapse worth panicking over. Though the Dow has fallen more than 400 points, or about 2.6 percent, since the beginning of the year, the Nasdaq and S&P 500 remain on positive ground.

“This is not the end of the world,” Eric Green, the head of U.S. rates and economic research at TD Securities, wrote in a note to investors. “It is fundamentally a re-balancing that will take more froth out of an overextended market.”

Analysts cautioned that the market’s seesawing did not seem to portend that the economy was doomed to another extended recessionary dismal spell. But amid the chaos, they added, it might be hard for investors to tell the difference between a short-term correction and all-out economic pandemonium.

“It’s really hard to cut out the [strong market] fundamentals from the fear,” said Canally, the LPL Financial economist. “On days like today, it’s impossible.”

Ylan Q. Mui contributed to this report.