Tesla confounded critics on Wednesday by reporting healthy profits and significantly positive cash flow in the third calendar quarter.

For months—years, actually—critics have warned that cash flow problems threatened the company's survival. Many experts scoffed when CEO Elon Musk claimed back in April that he would deliver positive cash flow—and profits—starting in the third quarter of 2018. Bloomberg ran a splashy feature titled "Tesla Doesn't Burn Fuel, It Burns Cash"—complete with a graphic of Musk throwing dollar bills into a pair of Boring Company flamethrowers.

"They're going to be on the verge of bankruptcy, because they need the capital markets to survive," investor John Thompson told Fox News the same month.

"With analysts forecasting a slowed, but continued, cash burn in the second half of 2018, Tesla may need to borrow up to $2 billion by the end of the year to stay afloat," Reuters reported in August.

Wednesday's results showed that these analysts were wrong. Tesla is in no danger of going bankrupt. With $3 billion in the bank and a growing cash cushion, Tesla won't need to raise any cash to pay off the big $920 million loan that's coming due next March.

Why critics underestimated Tesla

Analysts thought Tesla was in trouble earlier this year because the company had been burning almost a billion dollars a quarter in late 2017 and early 2018. If that burn rate had continued, Tesla would have had only a couple of quarters of cash left. People doubted anyone would lend more cash to a company that already had around $10 billion in debt.

But all of that hand-wringing turned out to be misguided. The massive burn rate Tesla suffered in 2017 and early 2018 was a temporary situation associated with the ramp-up of Model 3 production. That ramp-up is now largely over, so Tesla is generating cash, not consuming it.

"Tesla is 15 years old, but it's still fundamentally a startup," I wrote back in July. And this is essential for understanding the company's financial situation. It might seem strange to describe a company with a $50 billion valuation as a startup. But what I meant was that Tesla was still making bet-the-company investments in pursuit of rapid growth.

Building a car company from scratch is difficult because car manufacturing is both technically challenging and extremely expensive. It's not easy to convince investors to give billions of dollars to a company with no track record of successful automobile manufacturing.

Tesla's strategy has been to attack the problem in stages. First, it built a low-volume, high-end sports car: the Tesla Roadster. Then it built a medium-volume luxury sedan: the Model S (and the similarly priced Model X). Finally, it built the high-volume and relatively affordable Model 3.

Each time, Tesla used revenues from one car generation to finance the development of the next one. But more importantly, each success built investor confidence, allowing Tesla to raise more capital for the next vehicle. And Tesla needed more and more capital for each vehicle because it was trying to achieve higher and higher manufacturing volumes.

Free cash flow, explained

A chart of Tesla's cash flow illustrates this situation nicely:

Free cash flow is a measure of how Tesla's "cash in the bank" is changing quarter by quarter. When free cash flow is negative, a company needs a source of outside capital—either taking out loans or selling shares—to finance continued spending. By contrast, positive cash flow means that more cash is coming in, allowing a company to pay down its debts.

It's important to note here that free cash flow is not the same as profits. If Tesla spends $1 billion on a new factory, the full $1 billion will be counted against free cash flow in the next quarterly statement. On the other hand, an accountant computing profits will treat the factory as an asset that depreciates over many years. So when a company is investing heavily, it's likely to have big negative cash flow—even if the investments generate big profits in the long run.

Some people have looked at Tesla's free cash-flow chart and drawn the conclusion that Tesla was doomed to bleed cash indefinitely—until it eventually went bankrupt. But if you pay attention to the changes in Tesla's free cash flow over time, you can see there was method to the madness.

Each time Tesla has begun work on a new vehicle, cash flow has turned sharply negative as Tesla spent heavily to design the vehicle and build up its manufacturing capacity. Around the time each vehicle starts coming off the assembly line, the negative free cash flow hits a peak. Then a few quarters later, as the factory gets close to capacity, free cash flow turns positive. Tesla achieved positive cash flow in late 2013, mid-2016, and now in mid-2018. And the company experienced profits, however small, during each of these time periods as well.

If Tesla had decided to rest on its laurels in 2014 and not start work on the Model X, Tesla probably could have enjoyed several years of positive free cash flow—and perhaps profits—from sales of the Model S. But Musk wasn't interested in resting on his laurels.

Having proved to Wall Street that he could bring the Model S to market, Musk quickly raised more money to start ramping up production on the Model X. With access to more capital, Musk could do this more quickly, generating a higher cash-burn rate and bringing the Model X to market more quickly. Then when the Model X started to generate positive cash flow, he raised still more money and began the even more ambitious effort to build the mass-market Model 3.

So when Tesla was burning a lot of cash earlier this year, there was every reason to expect history to repeat itself: for the big spending ahead of the Model 3's launch to turn into positive cash flow once Model 3 production had ramped up. I wrote as much back in April and again in July. But even I was surprised about how dramatic Tesla's turnaround has been. I thought Tesla might eke out narrowly positive free cash flow and turn a slight profit in the third quarter. Instead, Tesla far exceeded expectations, generating free cash flow of $881 million in the third quarter and earning a $312 million profit.

Tesla says it expects similarly strong results in the fourth quarter, and there's little reason to doubt this. The company says it saw significant efficiency improvements in the third quarter of 2018, and we can expect additional improvements in the fourth quarter. Those cost savings enabled Tesla to cut the price of the cheapest Model 3 from $49,000 to $46,000, which should help ensure robust demand in the fourth quarter.

Tesla isn’t a startup any more

Elon Musk isn't going to rest on his laurels now any more than he did after the Model S. Tesla has already announced several forthcoming products—the Model Y, a new roadster, and a Tesla Semi. We can expect Tesla to ramp up spending for one or more of these products in the next few months, which will create a drag on free cash flow.

But these future product launches won't be bet-the-company the way the Roadster, the Model S and the Model 3 were. Each of those earlier products represented an order-of-magnitude increase in Tesla's production volume. If the Model S or the Model 3 had failed, Tesla really would have been at risk of bankruptcy.

The stakes won't be so high for Tesla as it launches its next few products. The Model Y is designed to be sold in volumes comparable to the Model 3. The more expensive Roadster and Semi will probably be sold in smaller volumes. Manufacturing them will certainly be expensive, but now Tesla will likely be able to tap significant profits from the Model S, Model X, and Model 3 to help finance them. Lenders will have far less reason to worry about Tesla going bankrupt, making it easier for Tesla to raise money.

That's not to deny that Tesla faces continued challenges. Accounts payable—money Tesla owes to its suppliers—ballooned from $2.4 billion to $3.6 billion over the last year. Tesla has a reputation for squeezing suppliers, and suppliers may demand that Tesla pay its bills more promptly now that it has more cash in the bank.

Tesla is also facing the phaseout of a generous $7,500 electric-vehicle tax credit next year in the United States, which could be a drag on sales in 2019 and beyond. On the other hand, Tesla won't even begin sales of the Model 3 in Europe until early 2019. And the fact that Tesla has sold so many Model 3 vehicles for more than $50,000 suggests that there will be even more pent-up demand if Tesla eventually gets the price down to the long-promised $35,000.

In the future, Tesla will have a growing portfolio of products, with no single product accounting for the lion's share of its revenue or profits. Some products will sell well, others will sell poorly or run into production problems. But Tesla's survival will no longer hinge on the success of any single product, as it did for the Model 3.