Tesla's handsome Model S sedan continues to rack up accolades – and sales. Photo credit: Tesla Motors.

Tesla Motors (TSLA -1.11%) reported late on Wednesday that second-quarter deliveries of its all-electric Model S sedan totaled 5,150, about 650 more than expected.

The news sent already high-flying Tesla shares soaring once again: Tesla stock was up 14% in after-hours trading on Wednesday night.

Oh, and Tesla also reported second-quarter earnings numbers, but those require a bit of explaining.

Tesla's loss, or profit, depends on how you look at it
I'll explain the earnings in a moment, but I started this article – which really is about Tesla's earnings – with the news about its deliveries for a good reason. Tesla is still very much an early stage company, and increases in sales arguably matter a lot more than small profits and losses at this point.

That said, the numbers matter too.

And here they are: In the second quarter, Tesla lost $30.5 million, or $0.26 a share, on a net basis – including the effects of taxes and one-time items. On an operating basis, excluding the effects of taxes and one-time items, Tesla made $26 million, or $0.20 a share.

But that $0.20 a share result included $0.15 worth (or about $19 million) of Tesla choosing to account in a non-standard way for the effects of its lease-like financing program. Tesla said that its operating profit calculated according to more conventional assumptions – the way Wall Street analysts present their earnings estimates – was about $7 million, or $0.05 a share.

So depending on how you look at it, it's fair to say that Tesla lost $30.5 million, made $26 million, or made $7 million during the quarter.

I know, it's enough to make one's head spin around. But here's the simple takeaway: Wall Street expected Tesla to post an operating loss of between $0.17 and $0.20 a share, and instead – by the same standards – it made a nickel.

In other words, Tesla trounced Wall Street's estimates, just as I expected. But while that's exciting and helped the stock to a quick jump in price, it doesn't matter all that much.

Here are the numbers that really show how well Tesla is doing.

The numbers that matter look pretty good
CEO Elon Musk said in a statement that Tesla improved its production output from 400 cars a week to almost 500 over the course of the quarter. The company's gross profit margin (including Tesla's way of accounting for the leasing program) rose to 22% in the quarter from 17% last quarter – excellent for an automaker of any kind, and not far off the long-term expectations for Tesla's profitability (25%) that Musk has been setting for a while.

That increase was helped by a number of cost improvements, Musk said, which included "redesigning many elements of Model S for greater ease of manufacturing, economies of scale and supply chain improvements." Not surprisingly, Tesla is learning as it goes – and its relatively small volumes mean that it can introduce refinements to its products and processes on the fly, all good stuff.

Tesla's net revenues for the quarter were $405 million, about the same as last quarter despite the 5% increase in deliveries. Musk said that the difference was largely accounted for by a drop in revenue from the sale of ZEV credits issued by the state of California. Those accounted for $68 million last quarter and $51 million this time around.

Tesla also booked $4 million in revenue from Daimler (MBGA.F 1.38%), part of an ongoing project to develop an electric drivetrain for an upcoming Mercedes-Benz model.

Cash at the end of the quarter was $747 million, up $516 million from last quarter. Tesla raised a little over $1 billion during the quarter from a follow-on stock offering after its stock price jumped during the spring.

That's all good stuff.

The outlook: continued sunshine in the near term
Musk said that Tesla expects to deliver "slightly over 5,000" cars during the third quarter, despite the fact that production is rising: A "considerable number" of cars will be in transit to Europe at quarter-end, and so Tesla won't recognize them as sold until later on. The company remains on target to deliver 21,000 cars for the full year, Musk said.

Expenses are likely to be up as Tesla continues work on the upcoming Model X SUV, expands its retail and service networks, and in expanding production capacity at its California factory, Musk said.

Long story short: Tesla's still on course and still ramping up according to plan, and I still give Musk and his team big props for execution so far. While some big longer-term challenges remain, the near-term looks quite good.

Last but not least, a programming note: Several of my fellow Motley Fool analysts will be taking a deeper dive into Tesla's quarterly report over the next few days. If you're a Tesla shareholder, stay tuned for more analysis and commentary from now through the weekend. Thanks for reading.