Tesla shares soared by more than 12 percent in premarket trading after the company reported a surprise profit for the third quarter as CEO Elon Musk made good on his promise to start turning regular profits in the last half of the year. The company's earnings report, released after the markets closed Wednesday, also showed better-than expected car sales and a faster timeline on its Model 3 production. The electric car maker said its midsize Model 3 sedan, which it hopes to produce on mass scale, was the best-selling car in the U.S. when measured by revenue and the fifth best-selling car in terms of volume. Musk told analysts on a call it was an "incredibly historic quarter" for the young car company. It was welcome news for investors following an otherwise a tumultuous few months. The company's shares settled after the markets opened but were still up by about 6 percent in morning trading. Here's how the company did compared with what Wall Street expected, based on average estimates of analysts polled by Refinitiv: Adjusted earnings: $2.90 a share vs. an expected loss of 19 cents per share

Revenue: $6.82 billion vs. an expected $6.33 billion Tesla posted net income of $311.5 million, or $1.75 per share, compared with a loss of $619.4 million, or $3.70 per share, a year ago. Revenue surged 70.5 percent from $4 billion from June and more than doubled from a year ago. After one-time adjustments, Tesla earned $516 million during the quarter. It was Tesla's third profitable quarter and compares with an adjusted loss of $520 million during the same period last year. Musk previously said the company would become sustainably profitable by now, having had just two profitable quarters prior to Wednesday's report since it went public in 2010. The company confirmed that it also expects to generate a profit during the fourth quarter.

Production rates improve

Tesla gave investors hope that its production rates will improve, saying that the number of labor hours to build the Model 3 fell by more than 30 percent from the second to the third quarter, and it took less time to build than the Model S sedan and Model X sport utility vehicle — another first for the company. The electric car maker has been struggling to ramp up production of its Model 3 sedan, telling investors Oct. 2 that it made 53,239 of the vehicles during the quarter. That fell just shy of its goal of producing an average of 5,000 a week, but the company said it built more than 5,300 during the last week of the quarter.

"We will focus even further on cost improvements while continuing to increase our production rate" during the fourth quarter, the company said. Strong demand for the Model 3 also bolstered the results. Musk told analysts on a call that demand for Model 3s was "probably on the order of anywhere from 500,000 to 1 million cars a year." The company said customers were trading in cheaper vehicles to buy a Model 3, "even though there is not yet a leasing option." "This leads us to believe that the total market potential for Model 3 is larger than just the premium sedan," the company said. Musk announced on Twitter Tuesday that the company is limiting certain options on its higher-end Model S sedans and Model X SUVs to streamline production. The company also recently announced plans to start selling a $45,000 version of the Model 3; the price was raised this week to $46,000. It has yet to produce the base Model 3, which it has promised for a price of $35,000 before incentives. The company said it was "working hard" to bring down the price on its Model 3 to $35,000. "Better than expected Model 3 cost reduction is allowing us to bring more affordable options to the market sooner," the company said, noting its slight price cut over the last week. CEO Elon Musk gave guidance that Tesla was probably less than six months from rolling out that lowest priced version of the Model 3.

China accelerates