SAN FRANCISCO -- Tesla lost US$408 million in its latest quarter as it struggles to prove it can make money selling electric cars at mass-market prices.

The setback announced Wednesday had already been telegraphed by Tesla CEO Elon Musk. Still, it underscored Tesla's ongoing challenges and helps explain why the company's shares have plunged by more than 20% this year while the Standard & Poor's 500 index has surged by 20%.

On the upside, Tesla's second-quarter revenue climbed 47% from the same time last year to $5.2 billion. It also generated $614 million in cash, helping fatten its bank account to $5 billion through June. That's money Tesla is going to need to repay its massive debt and other bills.

In a sign that investors are still worried about Tesla's future prospects, its stock dropped more than 10% to $237.02 in extended trading after the results came out.

Tesla has sustained losses of more than $6 billion since its inception, but Musk promised a year ago that the road ahead would be paved with profits. The Palo Alto, California, company made good on that pledge with a profit of $451 million during the final half of last year. But it has now has posted successive quarterly losses totalling $1.1 billion in the first half of this year.

The loss of $2.31 per share for the April-June quarter was worse than the $1.27 per share loss that analysts had expected, according to FactSet. It also came despite Tesla selling more electric cars -- 95,356 -- than in any other quarter in its history. The company remains behind the sales pace needed to realize Musk's goal of delivering 360,000 to 400,000 cars this year.

In a shareholder letter released with its second-quarter result, Tesla said it will focus more on increasing its manufacturing capacity and its deliveries of cars instead of hitting a specific financial target.

Musk then told investors during a conference call that Tesla should be "around break even" in its current quarter ending in September and expected to turn a profit during the final three months of the year. "I feel pretty confident about that," Musk said.

But just reaching the lower-end of Musk's car-delivery goal for this year may prove difficult. That's because the U.S. has reduced its tax incentive for electric car purchases, which will be phased out entirely at the end of the year.

Even if Tesla realizes its objectives, "Does it matter how many cars you sell, if you can't make a profit on them?" wondered Clement Thibault, an analyst at Investing.com.

Tesla is pinning its hopes largely on its lowest-priced vehicle so far, the Model 3 sedan, which starts at $35,000. That's comparable to other mass-market cars, but many analysts doubt the company can make money on the Model 3 at its starting price. Tesla other's cars, the Model S and Model X, both sell for more than $70,000 -- far beyond the reach of most consumers.

"We have to make cars more affordable," Musk conceded during the conference call.

Musk also believes Tesla can reel in profits by launching a ride-hailing service composed entirely of driverless cars by the end of the next year. His plan will offer Tesla owners with cars equipped with a special self-driving chip to allow their vehicles to operate in a fully robotic mode so they can pick up fare-paying passengers.

Musk envisions up to 1 million Teslas moonlighting as robotaxis, although most self-driving car experts don't believe it will be remotely possible to pull off by the end of 2020. In a sign that autonomous cars aren't coming along as quickly as once envisioned, General Motors has scrapped its plans to offer a fully driverless ride-hailing service in San Francisco this year.

Besides releasing its financial results, Tesla revealed that its longtime chief technology officer, Jeffrey Straubel, is stepping down from the position to become an adviser. Straubel is being replaced by one of his subordinates, Drew Baglino.