Tesla (NASDAQ:TSLA) surprised investors on Wednesday afternoon with better-than-expected profitability, marking the company's fourth-consecutive quarter with a positive bottom line. Tesla posted non-GAAP earnings per share of $2.18, up from a loss of $1.12 in the year-ago quarter. Analysts, on average, were expecting non-GAAP earnings per share of $0.03.

Even on a GAAP basis, the electric-car company's earnings per share (EPS) was $0.50, up from a loss per share of $2.31 in the year-ago period. Revenue similarly beat expectations. 

Of course, critics are quick to point out that Tesla's profitability benefited from $428 million of zero-emission regulatory credits. Without this benefit, the automaker would have reported a GAAP loss during the period.

Nevertheless, Tesla's reported bottom line during the period is still impressive. Here are two reasons why.

A Tesla Model X with its falcon wing doors open

Model X. Image source: Tesla.

1. Tesla's main factory was shut down for half of the quarter

To appreciate Tesla's impressive progress on scaling its business recently, particularly in Q2, investors should keep in mind that the automaker's main factory in California was shut down for nearly half of the quarter. This meant that Tesla endured both a costly shutdown and a costly production ramp up after business resumed.

Going into Q2, Tesla's California factory accounted for more than 70% of Tesla's production capacity. Therefore, the setback the factory had on the automaker's ability to deliver vehicles during the period was substantial. Further, the idle production capacity led to operational inefficiencies and higher costs, Tesla confirmed in its second-quarter earnings call.

Despite these challenges, Tesla's non-GAAP automotive gross margin, when excluding the benefit from sales of zero-emission vehicle credits, was 18.7%, up from 17.2% in the second quarter of 2019.

2. The automaker was ramping up production of a new vehicle

Making this adjusted automotive gross margin expansion on a year-over-year basis even more notable, it occurred during a period in which Tesla was ramping up production of a new vehicle. Tesla launched its new Model Y in March.

A person driving a blue Tesla Model Y

Model Y. Image source: Tesla.

Historically, new-product launches have weighed heavily on Tesla's financials in their first several quarters of availability. But Tesla said in its second-quarter update that improvements in Model Y product and manufacturing costs were a driver of profitably during the quarter, as opposed to weighing on results.

Tesla confirmed that the Model Y production ramp-up was setting new standards for the company.

"Although the Model Y production line was operating for about four months in the first half of 2020 due to shutdowns, we exited Q2 with Model Y production running at installed capacity," management explained in its second-quarter shareholder letter. "This ramp [up] was significantly faster than our initial Model 3 ramp [up], which took over nine months to reach the same weekly rate."

To show signs of scalability in a quarter plagued with uncertainty and stifled by a pause in production that lasted nearly half of the quarter is extraordinary in the capital-intensive auto industry. Of course, Tesla stock has already priced in industry-leading operating margins and rapid growth in the coming years.

This evidence of operational progress and manufacturing maturity doesn't necessarily make the stock a buy at this level, but it helps confirm that the story is changing -- and that the stock's recent run-up may be more justifiable than critics would think.