Musk’s electric car maker has posted profits for four straight quarters, paving the way for stock’s S&P 500 inclusion.

Tesla Inc on Wednesday posted a second-quarter profit despite the ongoing global coronavirus pandemic, sending its stock up six percent in after-hours trading and clearing a hurdle that could lead to the electric car maker’s inclusion in the S&P 500 index.

Tesla said it earned nonadjusted net income of $104m from April to June, or a $0.50 per-share profit, marking the first time the company has posted a profit for four straight quarters, a necessary goal for it to be included in the stock index of the largest United States companies.

That could prove another boon for Tesla because fund managers who track the S&P 500 would snap up the stock if it were included in the index.

The result marks a major accomplishment for Chief Executive Elon Musk, whose mission of leading the global auto industry into an electric future has frequently been questioned by investors who doubted the viability of Tesla’s business.

Tesla’s shares have enjoyed a meteoric rise in recent months, gaining more than 500 percent over the past year. Many analysts believe the share rally has been fuelled in part by expectations of Tesla’s imminent inclusion in the stock index.

The company on Wednesday affirmed its goal to deliver at least half a million vehicles by the end of 2020 despite production interruptions, including the shutting of its California factory for nearly six weeks of the quarter on the orders of local authorities.

“While achieving this goal has become more difficult, delivering half a million vehicles in 2020 remains our target,” the company said.

Tesla’s second-quarter revenue fell to $6.04bn from $6.35bn a year earlier, but surpassed analysts’ expectations for revenue of $5.37bn, according to IBES data from Refinitiv.

Tesla reported $5.18bn in second-quarter automotive revenue, but its share of income from regulatory credits – payments the company receives from other carmakers to offset emissions – increased to eight percent to $428m.

The company said higher income from those credits – in combination with temporary employee salary cuts during the pandemic and deferred revenue from its yet-to-be-released self-driving feature – offset the cost of factory shutdowns.

Musk on Tuesday qualified for a payout worth an unprecedented $2.1bn, his second jackpot since May from the electric car maker following its massive stock surge.

Tesla is looking to expand vehicle production by building a new factory in the US Southwest as soon as the third quarter, with Texas’s Travis County and Oklahoma’s city of Tulsa vying for the new plant.

The company on Wednesday said a site has been selected and preparations are under way, but did not provide further details. Officials for Tulsa and Travis County did not immediately respond to requests for comment.

Travis County has offered some $65m in tax rebates to entice the company, which plans to produce its Model Y sport utility vehicles and futuristic Cybertruck at the new factory.