Tesla Motors reported a quarterly profit on Wednesday as record deliveries helped to offset rising expenses related to next year’s roll-out of the company’s mass-market Model 3 sedan.

Tesla, led by billionaire entrepreneur Elon Musk, posted net income of $21.9 million, or 14 cents per share, for the third quarter ended Sept. 30 compared with a loss of $229.9 million, or $1.78 per share, a year earlier.

Total revenue more than doubled to $2.30 billion.

On an adjusted basis, Tesla reported a profit of 71 cents per share, compared with a loss of $1.35 per share in the same period last year.

Tesla tsla reiterated its delivery target for the second-half of 2016, saying it expected to deliver just over 25,000 vehicles in the current quarter.

The Silicon Valley carmaker said earlier this month that it delivered 24,500 vehicles in the latest quarter, an increase of 70% from the same period last year.

 

Get Data Sheet, Fortune’s technology newsletter.

Tesla is counting on the $35,000 Model 3 to help it meet its goal of producing 500,000 cars annually in 2018.

Tesla said it had $3.08 billion in cash and cash-equivalents as of Sept. 30, compared with $3.25 billion at the end of the second quarter.