Share of Tesla jumped Thursday, helping spark a broader U.S. stock rally with one trading day left in a mostly down year.

The Dow Jones Industrial Average rose 345.16 points, or 1.05%, to close at 33,220.87. The S&P 500 rose 66.10 points, or 1.75%, to close at 3,849.32, and the Nasdaq Composite Index rose 264.80 points, or 2.59%, to close at 10,478.09.

All three indexes will likely post losses for 2022 after Friday's close, the last trading day of the year. The Dow, S&P 500 and Nasdaq Composite are down about 9%, 20% and 35%, respectively, for the year.

The advances Thursday reversed a broad selloff during the regular session Wednesday and most of the week as recession fears continued to weigh on investors, dousing hopes for a sustained "Santa Claus" rally to end the year.

Carmaker Tesla's stock surged after Morgan Stanley said the carmaker's stock was now a bargain after losing nearly one-third of its value since September. Shares of Tesla (TSLA) rose 8.08%. or $9.11 a share, to close at $121.82.

Some stocks that rose Thursday included Apple (AAPL), which closed at $129.61, up $3.57, or 2.83%. Netflix (NFLX) shares rose 5.14%, or $14.24 a share, to close at $291.12.

"We were overdue for a rebound, and a lot of the recent weakness may be explained by further tax loss selling once the Santa Rally didn't materialize," Louis Navellier, founder and chief investment officer Navellier & Associates told CNBC. "We'll have further volatility into the new year with plenty of uncertainty about whether a soft landing is possible and if not how much resolve the Fed will have to not pivot if we tip into a serious recession."