Tesla shares were up more than 5 percent in extended trading after the earnings report.
While Tesla posted stronger sales of its existing vehicles — the Model S sedan and Model X sport utility vehicle — the biggest challenge it faces is preparing for the introduction of the Model 3, the company’s first foray into the mass market, with prices starting at $35,000.
The company has consistently lost money because of heavy spending on research, product development and equipment for its assembly plant in California and its battery factory in Nevada.
Elon Musk, a founder of the company and its chief executive, has said Tesla is earning good margins on the small number of Model S sedans and Model X sport-utility vehicles it has sold.
But while sales are rising, the per-car profits are not nearly substantial enough to cover Tesla’s high investment costs.
Tesla’s best hope for improving its financial results is to produce a steady flow of new Model 3 vehicles for delivery to customers later this year.
Interest in the Model 3 has been huge since Tesla began taking $1,000 deposits on it more than a year ago.
At an event last Friday where the first 30 of the vehicles were delivered to their new owners — all of them Tesla employees — Mr. Musk said that more than 500,000 prospective buyers had put down deposits.
“We are going to do everything we can to make cars as fast as we can,” he said. “Demand is not a challenge here.”
Tesla produced about 25,000 cars in the second quarter, which translates to an annual rate of 100,000. But Mr. Musk reiterated on Friday that the company still hoped to produce 500,000 cars next year.
Industry analysts have been hesitant to express doubts about Mr. Musk, mostly because Tesla has already defied expectations for a start-up automaker.
But investors are scrutinizing how quickly the company can accelerate production to begin delivering a significant number of Model 3s to buyers this year.
Mr. Musk’s widely reported comment last week that Tesla faces six months of “manufacturing hell” has caused some analysts to question whether the company can meet its aggressive targets.
“This of course raises questions about Tesla’s broader ability to scale not just its manufacturing, but the entire supporting infrastructure,” said Clement Thibault, an analyst with the website investing.com.
The first Model 3s to be built will primarily be more expensive variations, at $44,000, equipped with longer-range battery packs and so-called autopilot features that enable the cars to be driven primarily by computer. Tesla will then add production of the base-price version.
The higher-priced, option-laden versions could generate better profit margins.
Tesla is also gaining some ground in the marketplace. The company reported that sales of the Model S and Model X in the United States totaled 3,100 vehicles in July, and it said that overall sales for the first seven months of the year had increased by 35 percent over the same period in 2016.