NEW YORK (Reuters) - U.S. stocks rebounded late to close higher on Thursday after the World Health Organization (WHO) declared the China coronavirus a global emergency, while earnings painted a mixed picture.

After the Centers for Disease Control and Prevention reported the first U.S. incident of person-to-person spread of the virus, the WHO said recent weeks have seen an unprecedented outbreak, met by an unprecedented response. It said it was not recommending limiting trade or travel to China.

“The market is starting to look at this and say at some point in time this will crest and the news will start getting better,” said Art Hogan, chief market strategist at National Securities in New York.

“Precautions are being taken and that means at some point there will be light at the end of the tunnel, that is when the market reacts constructively.”

Facebook FB.O shares slumped 6.14% after the social media company warned of slowing growth as its business matured and it reported a surge in quarterly expenses.

The decline weighed on the S&P communication services index .SPLRCL, which lost 0.79%. Defensive sectors such as utilities and consumer staples, considered safer in times of economic uncertainties, advanced.

The main U.S. stock indexes are on course for their second straight week of declines as the virus has disrupted global travel and forced several companies to suspend operations in China.

FILE PHOTO: A trader works on the floor of the New York Stock Exchange shortly after the opening bell in New York, U.S., January 24, 2020. REUTERS/Lucas Jackson

The Dow Jones Industrial Average .DJI rose 124.99 points, or 0.43%, to 28,859.44, the S&P 500 .SPX gained 10.26 points, or 0.31%, to 3,283.66 and the Nasdaq Composite .IXIC added 23.77 points, or 0.26%, to 9,298.93.

Earnings expectations have been slowly improving for S&P 500 companies, with Refinitiv data showing a 0.7% rise in fourth-quarter profit, compared with a 0.6% decline estimated at the start of the season.

Microsoft Corp MSFT.O gained 2.82% after it beat expectations for quarterly earnings, driven by Azure cloud computing revenue growth.

Tesla Inc TSLA.O jumped 10.30% after the maker of electric cars posted a second straight quarterly profit as vehicle deliveries hit a record.

Altria Inc MO.N slid 4.21% after the tobacco company said it took another $4 billion charge on its investment in Juul Labs Inc.

Package delivery firm United Parcel Service Inc UPS.N dropped 6.70% after it forecast full-year earnings below estimates.

After the close, Amazon AMZN.O gained 10% after fourth-quarter revenue topped expectations.

Declining issues outnumbered advancing ones on the NYSE by a 1.01-to-1 ratio; on Nasdaq, a 1.32-to-1 ratio favored decliners.

The S&P 500 posted 48 new 52-week highs and 14 new lows; the Nasdaq Composite recorded 57 new highs and 94 new lows.

About 7.72 billion shares changed hands in U.S. exchanges, compared with the 7.54 billion daily average over the last 20 sessions.