In a Thursday, June 14, 2018 file photo, Tesla CEO and founder of the Boring Company Elon Musk speaks at a news conference, in Chicago.
In a Thursday, June 14, 2018 file photo, Tesla CEO and founder of the Boring Company Elon Musk speaks at a news conference, in Chicago.
PHOTO: Kiichiro Sato/AP
Now playing
01:39
Elon Musk steps down as Tesla chairman
PHOTO: CNN
Now playing
03:14
In 2010, Elon Musk had big plans for Tesla. Listen to his predictions
Tesla co-founder and CEO Elon Musk introduces the newly unveiled all-electric battery-powered Tesla Cybertruck at Tesla Design Center in Hawthorne, California on November 21, 2019. (Photo by Frederic J. BROWN / AFP) (Photo by FREDERIC J. BROWN/AFP via Getty Images)
Tesla co-founder and CEO Elon Musk introduces the newly unveiled all-electric battery-powered Tesla Cybertruck at Tesla Design Center in Hawthorne, California on November 21, 2019. (Photo by Frederic J. BROWN / AFP) (Photo by FREDERIC J. BROWN/AFP via Getty Images)
PHOTO: FREDERIC J. BROWN/AFP/Getty Images
Now playing
02:01
Elon Musk has a lot to say about Covid-19. Some of it isn't true
Tesla Cybertruck
Tesla Cybertruck
PHOTO: Tesla
Now playing
01:36
Watch the Tesla Cybertruck's unbreakable windows break
Brussels, Belgium, Jan 18, 2019: metallic red Tesla Model 3 and blue Tesla model X at Brussels Motor Show.
Brussels, Belgium, Jan 18, 2019: metallic red Tesla Model 3 and blue Tesla model X at Brussels Motor Show.
PHOTO: Grzegorz Czapski/Shutterstock
Now playing
03:33
Analyst: We see good things happening with Tesla
Now playing
01:09
Elon Musk busts a move in Shanghai
PHOTO: Gabe Ramirez/CNN
Now playing
01:19
See Tesla's new Model Y
Now playing
01:53
How Tesla made electric cars sexy
PHOTO: Sean R Clark/CNN
Now playing
03:16
Tesla's Model 3 is a top seller. But it's not the electric car for everyone
PHOTO: Bloomberg/Getty Images
Now playing
03:21
Hear some of Elon Musk's most ambitious predictions
CHICAGO, IL - JUNE 14: Engineer and tech entrepreneur Elon Musk of The Boring Company listens as Chicago Mayor Rahm Emanuel talks about constructing a high speed transit tunnel at Block 37 during a news conference on June 14, 2018 in Chicago, Illinois. Musk said he could create a 16-passenger vehicle to operate on a high-speed rail system that could get travelers to and from downtown Chicago and O
CHICAGO, IL - JUNE 14: Engineer and tech entrepreneur Elon Musk of The Boring Company listens as Chicago Mayor Rahm Emanuel talks about constructing a high speed transit tunnel at Block 37 during a news conference on June 14, 2018 in Chicago, Illinois. Musk said he could create a 16-passenger vehicle to operate on a high-speed rail system that could get travelers to and from downtown Chicago and O'hare International Airport under twenty minutes, at speeds of over 100 miles per hour. (Photo by Joshua Lott/Getty Images)
PHOTO: Joshua Lott/Getty Images North America/Getty Images
Now playing
00:53
Musk opens up about Tesla's near 'death'
Now playing
01:04
Hear Elon Musk's bold predictions for Tesla robotaxis
Elon Musk
Elon Musk's Power Cut_00013520.jpg
Now playing
02:41
Investor: Have to take 'good and bad' with Elon Musk
PHOTO: Tesla
Now playing
01:30
Tesla cuts jobs to offset Model 3 cost
Now playing
03:16
Jim Chanos: Tesla falling behind GM, Audi in software
PHOTO: Ken Griffith/Kevin Lamb
Now playing
00:54
See Tesla become airborne for over 100 feet
(CNN Business) —  

Tesla has turned a profit as it nears the end of a long, trying year.

The company posted its third-quarter earnings Wednesday, with a net profit of $312 million, by far its largest ever. The company’s stock shot up around 10% during after-hours trading.

“Q3 2018 was a truly historic quarter for Tesla. Model 3 was the best-selling car in the US in terms of revenue and the 5th best-selling car in terms of volume,” (TSLA) CEO Elon Musk said in a letter to investors.

The earnings exceeded Wall Street’s expectations. Analysts polled by Refinitiv predicted, on average, a loss of about 19 cents per share. Adjusted net income was $2.90 a share.

Since it went public in 2010, Tesla has posted a profit in only two quarters: once in 2013 and again in 2016. Meanwhile, the company has lost more than $6 billion. A slew of debt bills are due in the coming months, which has left some investors concerned.

Tesla’s performance last quarter, however, marks the strongest signal yet that the company is moving on from the beleaguered roll-out of the Model 3, its first car intended for the mass market.

Musk pledged earlier this year that Tesla would be in the black by the end of the year. Analysts had mixed reactions. But this week Tesla abruptly moved up its scheduled earnings, which many took as a sign the company was eager to show off its quarterly profit.

The big question for Wall Street now is whether Tesla can maintain the momentum and consistently bring in more than it spends.

“Tesla had a very strong Q3, blowing past most expectations. Kudos to Elon Musk and team for surprising nearly everyone. Now, the question remains – can Tesla make this a habit, or this this a blip on the radar?” said Akshay Anand, executive analyst for Kelley Blue Book, in an emailed statement.

Wednesday’s earnings report marks Tesla’s first since Musk was ousted from the chairman role after he and the company reached a settlement with the Securities and Exchange Commission last month. He was given 45 days to exit the role.

The billionaire drew regulators’ scrutiny after he tweeted in August that he was locking down a deal to take Tesla off the stock market at $420 per share. The tweet triggered a stock surge. The SEC fined Tesla and Musk $20 million and ordered to company to install two new independent board members.

Tesla’s tough year

Tesla has been plagued by production issues with its Model 3 sedan. Musk promised to be churning out 5,000 cars per week by the end of 2017. It finally hit that goal over the summer.

The delay didn’t come without costs. Customers canceled orders, and the negative narrative was exacerbated by a slew of scandals surrounding Musk.

He has fired off late-night tweets and brushed off analysts on a corporate earnings call. He insulted and then was sued by a man who was working to rescue boys trapped in a cave in Thailand, and he’s sparred with journalists and investors he believed were unfair to him.

Musk’s latest controversy came to a head last month, when it looked like he would fight the SEC’s lawsuit over his pledge to take Tesla private, a pledge he reneged on shortly after he made it.

All that has lent for a rocky year for Tesla’ stock. And it’s still well-below it’s all-time high of nearly $390 per share. Tesla’s stock after Wednesday’s close was $288.50.

Better days ahead?

The company’s report comes one day after a longtime Tesla bear, Andrew Left of Citron Research, delivered an about face in blog post. He declared Tesla was “destroying the competition.”

“Citron is long Tesla as the Model 3 is a proven hit and many of the Tesla warning signs have proven not to be significant,” Left wrote.

Tesla’s stock climbed up more than 12% on Tuesday, egged on by Left’s post and news that earnings would go up sooner than expected.

The conference call Wednesday was a welcome reprieve for Tesla executives.

Musk has long faced detractors who have berated him for failing to meet his deadlines. But Musk happily touted the results on Wednesday, promising it was a sign of more to come.

“This quarter was an important step toward” sustained profitability, Musk said, adding he’s “excited about about what lies ahead.”

Rebecca Lindland, executive analyst for Kelley Blue Book, praised the latest earnings report and expressed optimism that Tesla will benefit from coming changes.

“Tesla rewarded investor confidence by finally booking a profit in the third quarter, despite an array of self-inflicted wounds,” she said in an emailed statement. “A new chairman and independent board members may provide management guidance and perspective, which makes this result sustainable in the long term.”

CNN’s Chris Isidore and Jordan Valinsky contributed to this report.