Electric car maker Tesla Inc. burned through $739.5 million in cash last quarter, paving the way to a company record $717.5 million net loss as it cranked out more electric cars.

But Tesla reiterated a promise from CEO Elon Musk to post net profits in the third and fourth quarters, and Telsa’s shares rose 4.7 percent to $315 in after-hours trading.

The net loss more than doubled from the same quarter a year ago, and was slightly larger than the first quarter. But Tesla’s cash burn in the second quarter slowed.

The Palo Alto, California, company said it lost $4.22 per share from April through June as revenue grew 43 percent to just over $4 billion. Adjusted for stock-based compensation, the company lost $3.06 per share. That was worse than Wall Street estimates. Analysts polled by FactSet expected a $2.88 loss per share.

In a statement released after the markets closed Wednesday, Tesla said it expects to produce 50,000 to 55,000 Model 3s in the third quarter, an increase of at least 75 percent from the first quarter. Tesla spent millions as it reached a goal of producing 5,000 Model 3 sedans per week by the end of June. It now says production is rising, with the goal of 6,000 per week by the end of August. The company said it expects to reach 10,000 Model 3s per week “sometime next year.”

Cash from selling the Model 3, which starts at $35,000 but runs far higher with options, is key to holding off more borrowing and turning a profit.

The company said expects to grow at a rapid pace and it should achieve sustained quarterly profits barring an unforeseen event or economic downturn.

“We expect to generate positive cash including operating cash flows and capital expenditures,” the statement said.

The company said it has cut back on capital spending by changing its strategy to produce the Model 3 on existing assembly lines, one in a giant tent, rather than adding all-new lines. Tesla projected total 2018 capital spending at just below $2.5 billion. That’s substantially less than the 2017 level of $3.4 billion.

During the second quarter, Tesla laid off 9 percent of its workforce as it worked toward Musk’s promise of making money. The company has never turned an annual profit and has had only two profitable quarters since becoming public in 2010. Tesla has also asked parts suppliers for refunds.

Last quarter, Musk dismissed analysts who asked questions about Model 3 reservations and other financial matters during the quarterly conference call.