Tesla reported its second consecutive quarterly profit Wednesday and better-than-expected sales, but its fourth-quarter earnings fell short of analysts' expectations and sent its shares south after the markets closed. CEO Elon Musk also announced a major change to the electric carmaker's executive ranks with the retirement of long-time Chief Financial Officer Deepak Ahuja. Tesla's shares, which rose 3.8 percent during the regular session, fell by about 5 percent in after-hours trading. Ahuja is being replaced by Zach Kirkhorn, previously the company's vice president of finance, Musk told analysts at the end of a conference call announcing the results.

Not as bad

The electric car maker's results and outlook for 2019 were not as bad as some had feared, but the automotive segment, which still comprises the majority of Tesla's business was less profitable than some had expected. This is Tesla's fourth profitable quarter overall since it went public in 2010, and the first time Tesla has reported back-to-back profitable results. Musk said last year that he expected Tesla to be sustainably profitable beginning in the third quarter of 2018. Earnings were hit on a number of fronts, the company said, citing a decline in revenue from the sale of regulatory credits, higher import duties on parts from China as well as lower prices on the Model S and Model X in China and a lower-priced midrange version of the Model 3. "Last year was definitely the most challenging year in Tesla history, but also the most successful," Musk told analysts on a conference call.

Mixed bag

Executives said the company's main priorities in 2019 include reducing costs, shipping as many cars as possible until more tariffs hit, getting Tesla's Shanghai factory running and improving service in North America. "This release was a mixed bag," CFRA analyst Garrett Nelson told CNBC. "The company generated strong free cash flow, which should ease balance sheet-related concerns, which is the biggest positive from this release in our view. Vehicle sales guidance for 2019 was a bit short of expectations, but not nearly the doomsday scenario some had expected resulting from the federal EV credit step-down." Here's how the company did compared with what Wall Street expected: Adjusted EPS: $1.93 versus $2.20, according to average estimates compiled by Refinitiv

Revenue: $7.23 billion versus $7.08 billion, according to average estimates compiled by Refinitiv

Revenue beat

On an unadjusted basis, Tesla made $139.5 million, or 78 cents a share, compared with a loss of $675.4 million, or $4.01 a share, during the last quarter of 2017. It generated $7.23 billion in total revenue, more than double its $3.29 billion in revenue during the same quarter in 2017. It also beat analysts' average sales estimates of $7.08 billion. Tesla said its cash position substantially improved by $1.45 billion, despite spending $230 million to repay convertible bonds during the quarter. The company should see higher revenues in 2019 as it substantially ramps up production and deliveries this year, aiming for 360,000 to 400,000 vehicle deliveries, about 45 to 65 percent more than its deliveries in 2018. Musk predicted its deliveries will grow 50 percent in 2019, "even if there's a recession."

Tax credits

Investors have been paying close attention to how profitable Tesla's cars are, particularly the Model 3 sedan. The federal tax credit on every Tesla vehicle sold was cut in half to $3,750 at the beginning of the year, after Tesla sold its allotted 200,000 units that qualified for the full credit. "That 360,000 to 400,000 vehicles is within the band of what the street was expecting, and I think there were fears that would be significantly worse given what we saw in North America with the EV tax credit," Wedbush analyst Dan Ives told CNBC. Jessica Caldwell, Edmunds' executive director of industry analysis, sees a tough year ahead for Tesla. "Things really aren't going to get any better for Tesla in the U.S. than they did at the end of 2018," she told CNBC on Wednesday. "Turning a profit, creatively addressing production challenges and getting the Model 3 to the masses were huge milestones, but keeping up this momentum is going to be virtually impossible."

She said its product line is starting to get stale and it faces new competition from Audi, Porsche and Jaguar.

Purgatory

"Tesla's in an awkward purgatory between being a start-up and a mainstream automaker, and the biggest open question heading into 2019 is where the company really goes from here," Caldwell said. "Tesla is used to owning the spotlight, but for the next year we might see a lower-key Tesla as the company takes baby steps to keep things moving along while it plans for the future." Eyes are watching whether Tesla needs to raise any more capital in the short term, especially given the fact that it needs to pay off $920 million in debt due March 1. Bondholders can convert the debt into equity if the shares trade at or above the strike price of $359.87. But below that price, Tesla would likely have to pay off the notes with cash. The company assured investors that it has "sufficient cash on hand to comfortably settle in cash our convertible bond that will mature in March 2019." Read Tesla's results here.