Elon Musk speaks at the International Astronautical Congress in Adelaide on 28 September 2017.
Photograph: Peter Parks/AFP/Getty Images

The past three months have been the worst of times and the best of times for Tesla. The troubled electric car company announced a surprisingly high profit on Wednesday for the same quarter in which its founder, Elon Musk, spun out of control.

Elon Musk says 'Teslaquila' is 'coming soon' as Tesla files trademark

Read more

The company made a profit of $312m in the last three months – comfortably beating analysts’ expectations – and revenues were also higher than expected at $6.82bn. Tesla’s shares shot up more than 10% in after-hours trading.

Over the same period Musk has been embroiled in a series of bizarre scandals. He is currently being sued by a British diver he called a “pedo” after the two rowed over how to save a group of children stuck in a Thai cave. Musk smoked cannabis while live on a radio show. He and the company have been fined and sanctioned by the US Securities and Exchange Commission (SEC) and are still under investigation by the justice department.

Sign up for the new US morning briefing

But despite its issues, Tesla is emerging as the leader in the electronic vehicles sector. In the third quarter of the year, the mid-priced Tesla Model 3 was the fifth bestselling passenger car in America, according to the industry analyst Edmunds. The Model 3 was the 18th bestselling vehicle in the US overall.

On a conference call with analysts, Musk pointed out that the company delivered more cars in the past quarter than it did in all of 2016. He also said Tesla expected to remain profitable in the next quarter and for “all quarters going forward” except those in which major debt payments are due.

The CEO also paid tribute to the company’s unusually devoted customer base.

“Customers actually cared about the future of the company so much that they volunteered their time to help the company succeed,” he said. “It chokes me up, actually.”

Despite that moment of emotion, however, the erratic CEO largely avoided the dramatics of prior earnings calls, relying on a bevy of company executives to answer technical questions and avoiding the bombastic promises he has indulged in in the past.

Jeremy Acevedo, the manager of industry analysis at Edmunds, said: “The third quarter in many ways serves as Elon Musk’s redemption – you may not agree with his approach, but you can’t argue with the numbers. Between the SEC battle, controversial interviews and Twitter feuds, Elon’s antics hit a zenith in the third quarter, yet Tesla managed to exceed production goals and the Model 3 outsold many of the most popular cars in America. Achieving profitability is a huge milestone, and one that even the most staunch Tesla skeptics would have to give them a little bit of kudos for.”

Musk mocks 'Shortseller Enrichment Commission' after SEC settlement

Read more

However, he said, issues remained. The Trump administration’s trade spat with China would hamper its growth in China and plans to get the cost of its Model 3 car down to the targeted $35,000 (they currently sell for about $49,000 and up) remain “a fantasy”, he said.

“If we could produce the $35,000 car today, we would do it,” Musk said on the earnings call. He suggested that it might take another six months to deliver the long-promised cheaper vehicle, saying: “That’s our mission.”

Musk refused to answer a question about the company’s search for new independent board members, saying they were “restrict[ing] questions to operational topics”. He agreed to step down as chairman of Tesla’s board as part of his settlement with the SEC.