The quarter that ended June 30 was a crucial one for Tesla in its quest to build a successful future around the Model 3, the more affordable sedan it is offering alongside the flagship Model S sedan and the Model X sport-utility vehicle. To meet its Model 3 production goals, the company set up a tent at its factory in Fremont, Calif., to augment its assembly line, and Mr. Musk said he had taken to sleeping at the plant.

Tesla used up more than $430 million of its remaining cash during the quarter, decreasing its cash supply to $2.2 billion. But analysts had braced for worse.

“I was expecting more cash burn,” David Whiston, an analyst at Morningstar.

In late June, Tesla passed a milestone, producing 5,000 Model 3s in a week — the benchmark it has said it needed to reach to become profitable. In July, it maintained that production pace “multiple times,” the company said Wednesday.

The output it anticipates in the third quarter — 7,000 vehicles per week across its entire fleet, or 350,000 per year — “should enable Tesla to become sustainably profitable for the first time in our history,” the company said in a note to investors.

That would be a significant accomplishment for a company that has never reported an annual profit — its latest quarterly loss was $743 million on $4 billion in revenue — and some analysts remain skeptical. The goal is plausible but could easily be derailed by production glitches, delivery delays and softer-than-expected demand for the Model 3, said Brian Johnson, an analyst at Barclays.