And while revenues jumped 42 per cent to $16.9 billion, they came in below the $17.1 billion projected by analysts.

The company cited the drag from Shanghai, where its factory was shuttered part of the quarter. But Tesla said it finished the three-month period with "a record monthly production level" after the China restart.

But Tesla said supply chain challenges remain an ongoing headache, as factory shutdowns, labour shortages, logistics and other issues "limited our ability to consistently run our factories at full capacity."

During the quarter, Tesla liquidated about 75 per cent of its holding of bitcoin, the value of which has declined sharply in 2022.

'Record-breaking' 2nd half

Several analysts had viewed the second quarter as the weakest of the year for Tesla in the aftermath of the Shanghai factory lockdown and other supply chain issues that have boosted costs.

But Tesla watchers are bullish on the second half of 2022 in light of the ramp-up at factories in Berlin and Austin, Texas, and the expected return to normal production in Shanghai.

The company confirmed its production outlook for the year and said it was focused on a "record-breaking second half of 2022."

Musk has shown boundless confidence in Tesla's ability to shake up the auto market, leading the company as it has met production targets on its core product, even as the lofty price-tag of the vehicles remain out of reach for many consumers.

But Musk has been less sanguine of late about the economy as a whole, saying last month that a recession "appears more likely than not" and confirming plans to reduce the company's salaried workforce by about 10 per cent.

Most recently, the controversial CEO has become embroiled in the messy fight with Twitter after Musk withdrew his takeover bid, citing concerns that social media company was undercounting the number of fake accounts.

On Tuesday, a Delaware judge set an October trial to hear Twitter's lawsuit on whether to force Musk to complete the transaction.

Musk's lawyers had pushed for a February 2023 date, but the court hewed closely to Twitter's desire for speed and set an October start.

Shares of Tesla added 0.3 per cent at $744.99 in after-hours trading.