Tesla Model 3 (2)
A row of new Tesla Model 3 electric vehicles is seen at a parking lot in Richmond, California, June 22, 2018. REUTERS/Stephen Lam

Shares of electric-car pioneer Tesla (NASDAQ:TSLA) surged 16 percent on Thursday, following the company's second-quarter earnings report. Tesla predicted that production of its Model 3 sedan will continue to rise steadily in the coming quarters, while earnings and cash flow will turn positive. It didn't hurt that CEO Elon Musk seemed even-keeled during Tesla's earnings call — and even apologized for shutting down analysts' questions on the first-quarter call.

This article originally appeared in the Motley Fool.

Still, many bears were flummoxed by Tesla stock's big jump, given that the company posted a record loss last quarter. However, the massive loss can be explained by launch costs related to ramping up Model 3 production. Investors should be far more concerned about management's forecast that Model 3 gross margin will remain below 25 percent through the end of 2018.

Tesla lost a lot of money last quarter

On Wednesday, Tesla reported a net loss attributable to common stockholders of $718 million for the second quarter of 2018. That was slightly greater than its first-quarter loss and more than double the loss it recorded in the year-earlier period. Results didn't look much better on a non-GAAP basis, either, as Tesla's loss more than doubled year over year to $520 million, or $3.06 per share.

Tesla's net loss was somewhat bigger than what most analysts had projected. That said, the company predicted it will turn profitable in the back half of the year, despite an expected headwind from higher Chinese auto tariffs. While that forecast isn't new, many investors have been skeptical that it was achievable.

However, it makes sense that Tesla would see a sharp improvement in profitability during the second half of 2018. The company expects to nearly double Model 3 production this quarter compared with the second quarter, which will help it cover fixed costs and boost gross margin.

Gross margin is finally rising

In the first quarter of 2018, Tesla's gross margin for Model 3 production was negative. In other words, Tesla wasn't even covering all of its production costs for the Model 3, let alone paying for development costs, selling expenses, or corporate overhead. Last quarter, "Model 3 gross margin turned slightly positive," according to the company.

Tesla expects dramatic improvement on this front in the second half of 2018, due to higher production -- it expects to build 50,000 to 55,000 Model 3s this quarter -- and the introduction of the pricier dual-motor and performance variants. Tesla says Model 3 gross margin is likely to reach 15 percent in the third quarter and 20 percent in the fourth quarter.

This outlook would appear to put Tesla on track to hit its 25 percent gross margin target sometime in 2019. That's just what the company says it expects.

This vehicle mix is unsustainable

While Model 3 gross margin is set to improve dramatically over the next two quarters, it still isn't clear that the 25 percent goal is within reach. It's important to note that Model 3 gross margin is being boosted by a mix heavily tilted toward the most profitable versions in the second half of 2018. This rich mix is clearly unsustainable.

As I have previously noted, the cheapest Model 3 variant currently available costs $49,000, far more than the base price of $35,000. With the dual-motor and performance versions having entered production recently, the Model 3 average transaction price could easily be around $60,000 in the second half of 2018.

There is clearly a meaningful pool of demand for Model 3s in this price range. Nevertheless, the vast majority of buyers can't afford to spend this much -- especially as the U.S. electric-vehicle tax credit phases out for Tesla purchases.

Indeed, there are hundreds of thousands of Tesla customers in the U.S. and Canada who have ordered or reserved a Model 3. Customers who want to buy dual-motor or performance variants have had a big incentive to place their orders ASAP, since the tax credit will start to phase out on Jan. 1. Instead, Tesla has opened up ordering to non-reservation holders, with a lead time of just a few months, or roughly one quarter. This move implies that far fewer than 100,000 reservation holders have placed orders. The rest are waiting for cheaper Model 3 versions to become available -- or have decided to cancel their reservations.

A downshift in the model mix will hurt profitability

Options and upgrade packages typically carry very high margins for automakers. If Tesla expects to earn a $12,000 gross profit on a $60,000 car by the fourth quarter, a 20 percent gross margin, it's likely that it would only break even on a $35,000 base model.

Tesla will probably be able to squeeze out some additional cost efficiencies in 2019. But given that it already expects to be building 6,000 Model 3s per week by the fourth quarter, there will be limited room for gross margin improvement. To look at it another way, going from producing an average of 4,000 Model 3s per week in the third quarter to 6,000 per week in the fourth quarter is expected to lift gross margin from 15 percent to only 20 percent.

Meanwhile, the production mix is likely to shift dramatically toward cheaper models next year. This could more than offset Tesla's underlying cost reductions. As a result, Tesla probably won't be nearly as profitable as it expects.

Adam Levine-Weinberg has no position in any of the stocks mentioned. The Motley Fool owns shares of and recommends Tesla. The Motley Fool has a disclosure policy.