Elon Musk's ambitious electric vehicle company scored about twice the profits in the just-finished quarter as that of the year-ago period.

In recent weeks, Musk has made headlines over his withdrawal from a $44-billion acquisition of Twitter, which has spurred a lawsuit from the social media giant.

Although profits topped estimates, they lagged behind those in the first quarter, the first sequential profit drop since late 2020, coinciding with a fall in automotive profit margins due to rising costs.

Revenues were up 42 percent at $16.9 billion, but below the $17.1 billion projected by analysts.

The company cited the drag from Shanghai, where the factory was entirely closed during part of the quarter. But Tesla said it finished the quarter with "a record monthly production level" after the China restart.

It characterized supply chain challenges as an ongoing headache, though, saying factory shutdowns, labor shortages, logistics and other issues "limited our ability to consistently run our factories at full capacity."

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

Shares of Tesla rose 1.9 percent to $756.63 in after-hours trading.