RTX2QJEW
Tesla Motors CEO Elon Musk introduced the falcon wing door on the Model X electric sports-utility vehicles during a presentation in Fremont, California, on Sept. 29, 2015. Reuters

Tesla Motors Inc. (TSLA) shares rallied Wednesday after posting its first quarterly net profit after 12 quarterly losses, trouncing estimates with the help of roughly $139 million in revenue from California clean-car credits and record production and sales.

The Palo Alto, California-based company reported a third-quarter profit of $21.9 million, or 14 cents per share. Revenue more than doubled to $2.3 billion from $936.8 million for the same period last year, and far exceeded Thomson Reuters analysts’ consensus estimates, which forecasted $1.98 billion in sales.

Since the company went public in June 2010, it’s only other profitable quarter was the first quarter of 2013.

The electric car maker’s revenue was aided by net orders for Model S, a sedan, and Model X, a luxury sports utility, which grew a combined 68 percent year-over-year. Model X captured 6 percent of the coveted U.S. SUV market. Tesla also achieved record production of 25,185 vehicles, which marks a 37 percent increase from the second quarter and a 92 percent increase from the first quarter.

Tesla’s $139 million in tax credits was a sharp gain from $39 million for the same quarter last year.

The company’s price of shares opened Wednesday at $201.00 and climbed in after-hour trading to 211.00, its highest level since Oct. 5. Earlier this month, Goldman Sachs downgraded Tesla from a "buy" to a "neutral."

“It’s definitely one of the best moments in Tesla’s history,” chairman and CEO Elon Musk said about the quarter in a conference call. “I think we’re headed to have a great fourth quarter as well. I currently believe (the fourth quarter) will be profitable excluding stock expenses.”

Meanwhile, Musk said there was no new capital needed for the Model 3, a sedan with a starting price of $35,000—roughly half the price of the Model S. The Model 3 will roll out in the second half of 2017.

Turning a profit for the quarter could help the proposed merger of SolarCity (SCTY), a solar power maker based in San Mateo, California, in which Musk is the chairman and principal shareholder. In June, Musk proposed Tesla buying SolarCity for about $2.45 billion, with a merger vote taking place on Nov. 17.

After the proposed deal, independent research team Argus had downgraded Tesla from a "buy" to a "hold."