Stocks closed higher on Thursday after a sharp comeback late in the session erased earlier losses stemming from concerns around the coronavirus.

The Dow Jones Industrial Average gained 124 points, or 0.4%. At its low of the day, the Dow was down 244 points. The S&P 500 ended the day up 0.3%. The Nasdaq Composite also gained 0.3%.

The major averages started paring losses with roughly one hour to go after the World Health Organization declared a global health emergency, but at the same time, did not recommend travel to China be restricted and said the country had the situation under control.

Airline stocks also rebounded, with American and United each closing more than 3% higher. Las Vegas Sands and Wynn Resorts, two coronavirus proxies for their gaming exposure in Macao, ended the day up more than 2% each.

Stocks were down for most of the session as the death toll in China from the coronavirus hit 171, with confirmed cases of the virus surpassing 8,000. The Centers for Disease Control and Prevention later confirmed the first human-to-human transmission of the virus in the U.S., pushing the major indexes back towards their session lows.

"The spread of the Wuhan virus isn't accelerating, but markets becoming more concerned about future earnings and economic growth as companies implement work stoppages to reduce the chance of the disease spreading," said Tom Essaye, founder of The Sevens Report.