Tesla (NASDAQ:TSLA) surged into profitability in the second half of 2018, buoyed by rising deliveries of its Model 3 midsize sedan. However, the company plunged back into the red in the first two quarters of 2019, even though it achieved a new delivery record in Q2. Price cuts and unfavorable mix shifts from the pricey Model S and Model X toward the Model 3 -- especially cheaper versions of the Model 3 -- drove this profit reversal in the face of record volume.

Tesla hit a new delivery record last quarter, but it just barely surpassed its Q2 delivery total. This made it seem like another quarterly loss was in the cards. Instead, Tesla surprised investors with a solid profit for Q3, driven by significant cost reductions.

Revenue falls, but Tesla posts a profit

Tesla generated $6.3 billion of revenue last quarter, roughly in line with analysts' expectations. This was down slightly from the second quarter and down 7.6% from $6.8 billion in the prior-year period.

Management noted that most of the revenue decline compared to Q3 2018 was driven by an increase in the mix of leased vehicles. (Tesla recognizes the revenue from a leased vehicle over time rather than at the time of sale.) That said, revenue would have fallen regardless of this factor, despite a 16% year-over-year increase in vehicle deliveries, because of a mix shift toward lower-priced vehicles.

A silver Tesla Model 3 parked on a road, with a green field in the background

Tesla's revenue declined last quarter, despite an increase in its vehicle deliveries. Image source: Tesla.

While revenue fell both sequentially and year over year in the third quarter, Tesla returned to profitability. Operating profit reached $261 million and net income reached $150 million. Both of those figures represented year-over-year declines but substantial improvements over the second quarter of this year. Excluding stock-based compensation costs, adjusted earnings per share came in at $1.86, whereas analysts had expected a small loss.

Cost reductions are the key

There were several factors behind Tesla's unexpected return to profitability last quarter. For example, foreign exchange gains accounted for nearly half of the company's GAAP pre-tax profit. In addition, Tesla booked $30 million of deferred revenue because of the U.S. release of its "Smart Summon" self-driving feature.

However, the most important factor was impressive cost discipline. Automotive gross margin rose to 22.8% from 18.9% in the second quarter. A stronger mix drove some of that improvement, but more efficient production operations also had a big positive impact.

Furthermore, Tesla reduced its selling, general, and administrative expenses to $596 million from $647 million in Q2 2019 and $730 million in Q3 2018 while also holding R&D spending roughly flat. Impressively, it was able to do so while also boosting order activity globally, preparing to launch volume production at a new plant in China, and speeding up the timeline for introducing the Model Y crossover.

This strong cost performance bodes well for the future. If Tesla can execute its ambitious growth plans successfully over the next few years while keeping spending in check, the company would be in line for phenomenal margin expansion.

Tesla is on the right track -- but don't believe all the hype

In light of these strong quarterly results, Tesla CEO Elon Musk was back to his usual optimistic self on the company's earnings call on Wednesday afternoon. During the course of the call, he made a series of bold -- and in some cases, thoroughly outlandish -- claims about what's next for Tesla.

For example, Musk predicted that the Model Y will sell better than the Model S, Model X, and Model 3 combined, all without cannibalizing any sales from those other models. He also said that Tesla's output would more than triple within a few years, thanks to the opening of new production facilities in China and Europe. In fact, he claimed that Tesla could eventually build 20 million vehicles a year, nearly double current market leader Volkswagen's 2018 sales volume. Finally, Musk opined that Tesla's energy business could one day be similar in size to its automotive business.

For those keeping score at home, these claims add up to an absurd prediction that Tesla's annual revenue could rise to as much as $2 trillion, albeit in the distant future. For comparison, revenue is on track to come in around $25 billion this year.

Luckily for bulls, Tesla can fall well short of Musk's goals and still achieve incredible growth in the years ahead. To be sure, the company may face meaningful headwinds. A slowdown in the Chinese auto market and anti-U.S. sentiment in China related to the ongoing trade war could offset the benefit of starting local production in that key market. Rising competition in the electric vehicle market combined with slowing auto sales in much of the world could also threaten Tesla's growth trajectory. Nevertheless, Tesla's long-term profit growth potential looks a lot better now than it did just a week ago.