Tesla posted its first profit this year on Wednesday, powering past a tumultuous third quarter that included a settlement with the federal government over tweets from founder Elon Musk.

Net income was $311 million, or $1.75 per share, the Palo Alto, Calif.-based company said. Tesla produced an average 4,300 units per week, and operating costs during the quarter rose 12.4 percent to $1.1 billion. The company delivered 56,065 of its Model 3s, the mass-market electric vehicle.

Musk and Chief Financial Officer Deepak Ahuja said Tesla's main challengers were "vehicle delivery and logistics," adding that inventory remained the lowest at the end of the quarter in the last two years.

"Fortunately, these challenges are easier to solve than vehicle manufacturing, and we made improvements through the quarter," the two wrote in the report.

To reduce costs, Tesla plans to increase Model 3 production in China and "progressively increase the level of localization through local sourcing and manufacturing."

"Production in China will be designated only for local customers," Musk and Ahuja wrote.

The company is expecting a $50 million reduction in profits in the remaining months of 2018 due to President Trump's tariffs on $250 billion on Chinese products. The cost increases on components sourced from the communist nation will affect Tesla's Model 3, S and X vehicles, and will only be partially offset by "increased manufacturing cost efficiencies."

Tesla expects overall operating expenses to grow slightly in the fourth quarter.

A federal judge recently approved a settlement between Musk, Tesla, and the Securities and Exchange Commission over the 47-year old entrepreneur's tweets that he had secured funding to take the company private at $420 per share, a claim that federal regulators say was not supported by fact.

The amount, a premium over the stock's existing value at the time, was chosen for its symbolism in the cannabis culture for smoking weed, regulators said. Both Tesla and Musk were required to pay $20 million fines and Musk was forced to relinquish his role as chairman of the company's board of directors.

Tesla's stock was up 9.42 percent to $315.67 in New York after-hours trading.