Tesla (NASDAQ:TSLA) stock has rocketed higher again in recent days, after the company easily beat analysts' estimates for its second-quarter production and vehicle deliveries. While the COVID-19 pandemic did take a toll on the electric vehicle maker, it wasn't quite as bad as some had feared.

That said, the deliveries beat was not as meaningful an event as many investors seem to believe. Last quarter, supply was the main constraint on Tesla's results. By contrast, in the long run, demand -- and, to a lesser extent, costs -- will be the primary determinants of Tesla's success.

Tesla smashes expectations

In late March, Tesla was forced to temporarily close its main factory in Fremont, California in response to the growing COVID-19 pandemic. The factory didn't start to reopen until May 11, in defiance of local authorities. While Tesla's new Gigafactory in Shanghai was busy building Model 3s for the Chinese market throughout the quarter, having reopened in February after a brief shutdown, the Fremont plant's temporary closure severely limited output last quarter.

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

Image source: Tesla.

As a result, Wall Street analysts were expecting big year-over-year declines in production and deliveries. Just a few weeks ago, many analysts were calling for a quarterly deliveries total below 70,000. As June progressed, the analyst consensus rebounded to around 83,000.

Last Thursday, Tesla reported that it built 82,272 vehicles last quarter. The Model S and Model X, which are only built in Fremont, accounted for 6,326 units of production, compared to nearly 76,000 for the lower-priced Model 3 and Model Y. Deliveries outpaced production, as Tesla drew down inventory built earlier in the year. The company delivered approximately 90,650 vehicles: 10,600 of the Model S and Model X, along with 80,050 of the Model 3 and Model Y.

This news sparked another spike in Tesla stock. Shares surged to a new all-time high above $1,300 on Monday: up nearly 500% over the past year.

TSLA Chart

Data source: YCharts.

A whole lot of hype

While Tesla's Q2 deliveries beat analysts' updated expectations by nearly 10%, the company still delivered 5% fewer cars than the 95,356 deliveries it achieved a year earlier. Tesla's production and deliveries figures may have been better than expected, but they still weren't good.

Of course, investors couldn't have hoped for anything better, given that Tesla's main factory was closed for nearly half of the quarter. However, this just highlights the irrationality of focusing so much attention on how many vehicles Tesla delivers in any single quarter.

Tesla's fully diluted market cap surged well past $250 billion on Monday. For comparison, delivering 90,000 vehicles in a quarter instead of 80,000 would likely improve cash flow by between $100 million and $200 million. In short, the financial implications are minuscule relative to Tesla's valuation. Furthermore, even if Tesla were to produce twice as many vehicles as it did last quarter, it still wouldn't generate much profit relative to its market cap. Tesla stock is valued based on its potential to earn massive profits in the distant future, making its near-term production and deliveries the sort of noise investors should ignore.

Demand and costs are what really matter

In the long run, Tesla will be able to build as many cars as it can sell profitably. Thus, future demand will be the main determinant of whether Tesla stock continues rising or falls back to earth. Costs are also an important part of the story. Maintaining a cost advantage through simple designs and purchasing scale for electric vehicle components will be crucial to achieving industry-leading margins -- and could also enable Tesla to introduce cheaper vehicles in the future in order to capture a wider swath of the market.

Tesla is well positioned to surpass 500,000 annual vehicle deliveries this year. It's clear from Tesla's sales figures in recent quarters that the company could sell an even greater number of vehicles if it had sufficient supply.

Yet even if its long-term operating margin reaches 15% -- well ahead of today's mass-market automakers -- Tesla probably needs to grow annual deliveries to at least 3 million or 4 million over the next decade to justify its current valuation. While this is a plausible target, it isn't guaranteed that Tesla will get there, particularly if it doesn't introduce more affordable models. To decide whether or not to invest in Tesla, investors need to focus on information that could shed light on long-term demand and cost trends while ignoring irrelevant news like Tesla's quarterly reports of production and deliveries.