Stocks rallied on Tuesday, building on solid gains from the previous session as the market recovers from a steep sell-off that was sparked by worries over the coronavirus.

The Dow Jones Industrial Average closed 407.82 points higher, or 1.4%, at 28,807.63. The S&P 500 gained 1.5% to end at 3,297.59 while the Nasdaq Composite advanced 2.1% to a record of 9,467.97. The tech-heavy benchmark became the first of the major indexes to come back completely from the coronavirus-related fears.

Stocks that have been hit by fears of the coronavirus slowing the economy bounced on Tuesday. Apple jumped 3.3%. Nvidia and Micron rose more than 2.5% each. Companies directly impacted by the coronavirus, including Carnival, which confirmed on Monday that a former cruise-line passenger tested positive for the virus, rose. Carnival added 1.9%. American and United were both up by more than 5%.

Tesla, meanwhile, powered the Nasdaq with a surge of more than 13% that lifted the stock above $900 for the first time. That rally follows Tesla's best day in six years. Billionaire investor Ron Baron, a longtime Tesla bull, said Tuesday that Tesla could see revenues of $1 trillion in 10 years. Tesla, however, gave back a chunk of its gains in the final minutes of trading. At its high of the day, Tesla had surged more than 24%.

Microsoft and Caterpillar both rose around 3% to contribute to the gains. The S&P 500 tech sector surged 2.6%, led higher by Apple.