The U.S. stock market staged a late rally Thursday as investors shrugged off some early concerns about risks posed by the coronavirus spreading through China, illustrating the volatility caused by uncertainty abroad. The Wall Street rally was a contrast to foreign markets, which largely slumped.

Chinese markets are closed until Monday for the extended Lunar New Year holiday, but Hong Kong’s Hang Seng Index shed more than 2.5 percent and Japan’s Nikkei declined 1.7 percent. European stocks followed suit, with the benchmark Stoxx 600 index down 0.95 percent in midday trading. The Dow Jones industrial average fell nearly 150 points at the opening bell, clawed back more than 100 points within minutes, then dropped again. It rallied in the afternoon, though, closing the day up 125 points. The Standard & Poor’s 500 and Nasdaq indexes both rose roughly 0.3 percent.

Investors and business leaders are still unclear about the scope of the economic impact from the coronavirus, but numerous companies have pulled back or temporarily suspended operations.

The virus, which has infected 7,700 and killed 170 in China, has paralyzed nation’s workforce, with at least three provinces barring all nonessential business activity until Feb. 10. In Hubei province, which has seen the most cases, business activity has been suspended until Feb. 14. And as authorities scramble for solutions to contain the spread, global firms with roots in China have been forced to shut their doors or temporarily freeze operations, without any certainty as to how long the disruption will last.

“Companies are taking decisive action over their exposure to China, such as canceling flights, closing stores and shutting factories,” Russ Mould, investment director at AJ Bell, wrote Thursday in a note to investors. “It is already clear that earnings will be hit as a result of the coronavirus and we still don’t know when the health incident will be contained.”

Starbucks earlier this week shuttered more than 2,000 locations — more than half its stores in the country — and McDonald’s, KFC and Apple have also announced closures. Google said it closed its five offices in mainland China, Hong Kong and self-governing Taiwan.

The outbreak is taking a toll on the airline industry, with British Airways and American Airlines reducing direct flights to and from China. Germany’s Lufthansa canceled all Chinese flights until Feb. 9, though it said it would continue service to Hong Kong.

Even though U.S. markets closed higher, some companies with economic ties to China slumped. Starbucks shares fell roughly 1 percent. Caterpillar, a global bellwether, fell as well.

Passenger air traffic was about 35 percent lower at the SARS outbreak’s worst point for airlines in the Asia-Pacific region, according to the International Air Transport Association. And for 2003 as a whole, the association estimated that SARS, or severe acute respiratory syndrome, cost those carriers 8 percent of their revenue, or roughly $6 billion at the time. The airline industry is being watched closely as flight cancellations persist.

On Thursday, the World Health Organization designated the outbreak a global emergency. Such a designation could signal that the worst is yet to come, for China and global businesses.

“The virus impact on Chinese industrial production and exports will likely force the PBOC’s hand into using the bazooka of stimulus they were saving in case the US-China trade war took a turn for the worse,” Ed Moya, an analyst with OANDA, wrote in a note to investors Thursday. “Until markets are confident the virus has peaked and the outbreak is finally contained, U.S. stocks will struggle despite strong earnings.”

Despite a 2.1 percent rise in fourth-quarter gross domestic product, the U.S. economy grew at the slowest pace since 2016 last year, the Commerce Department reported Thursday. Growth for the full year was 2.3 percent, compared with 2.9 percent in 2018 and 2.4 percent in 2017.

The slowdown defies claims from the Trump administration that stimulus from the 2017 tax bill, which yielded big cuts for corporations and households, would lead to 3 percent GDP growth.

In an interview with Fox Business, Commerce Secretary Wilbur Ross said the virus could have a positive impact on the U.S. economy, because health risks would force companies to seek alternatives to business in China.

“I think it will help to accelerate the return of jobs to North America,” he said.

At a Federal Reserve meeting Wednesday, Fed Chair Jerome H. Powell said that the central bank is closely monitoring the situation in China but that it is too early to know how big a bite it will take out of the global economy.

“The situation is really in its early stages, and it is very uncertain about how far it will spread and what the macroeconomic effects will be,” Powell said. “I’m not going to speculate about it at this point … We are very carefully monitoring the situation.”

Meanwhile, Facebook’s stock took a beating after the company reported fourth-quarter earnings that beat expectations but also showed a 51 percent rise in expenses compared with 2018. The social media giant’s shares ended the day down more than 6 percent.