Tesla Inc.’s new finance chief must quickly master the company’s sensitive working-capital arrangements and complex debt portfolio if he is to help chief executive Elon Musk achieve his goal of turning a profit throughout 2019.

An ability to work well with Mr. Musk, whose erratic behavior has at times been seen as a distraction for the company, will also be critical to the success of new chief financial officer Zach Kirkhorn, analysts say.

Mr. Kirkhorn became Tesla’s vice president of finance in December, according to his LinkedIn profile. He will replace current CFO Deepak Ahuja, who announced his plan to step down during Tesla’s quarterly conference call on Wednesday. The company didn’t give a date for the change.

Newsletter Sign-up CFO Journal The Morning Ledger provides daily news and insights on corporate finance from the CFO Journal team. PREVIEW

It is the most recent high-profile departure at Tesla following an exodus of dozens of executives in recent years. Mr. Ahuja has been in his second tour as Tesla CFO; he came out of retirement when former CFO Jason Wheeler resigned in 2017.

Tesla shares, which closed Wednesday at $308.77, FELL in after-hours trading on Wednesday, a move some analysts attributed in part to concern about Mr. Ahuja’s exit. Tesla stock was trading 5.2% lower in pre-market trading on Thursday.

Mr. Kirkhorn is a nearly nine-year veteran of the electric car maker’s finance team, making him both fluent in its financial arrangements and aware of his new boss’s temperament.

“It would’ve been riskier to bring in an outsider at this point, given the juncture the company is in,” said Daniel Ives, an analyst at Wedbush Securities Inc. “It could’ve disrupted things and that would’ve been the worry of investors.”

Tesla reported its first-ever consecutive quarterly profit on Wednesday. That feat wasn’t accomplished without pain: The car maker earlier this month said it would lay off 7% of its full-time workers to save costs.

Mr. Kirkhorn didn’t immediately return messages seeking comment. A Tesla spokesman referred to Mr. Musk’s remarks during the earnings call about Mr. Kirkhorn’s extensive background at Tesla and deep understanding of finance.

“Zach’s incredibly talented, has made a huge contribution to Tesla over the years, and obviously [is] very well known to the whole team and has the respect of the whole team,” Mr. Musk said on the earnings call.

Tesla has been a shrewd manager of working capital, cutting capital spending and stretching out payments to suppliers at the same time as taking in deposits from customers eager to own its electric cars.

“This is a delicate balancing act between managing growth and managing cash flow,” said Toni Sacconaghi, an analyst at investment manager AllianceBernstein Holding LP.

The company’s new goal of achieving a profit every quarter this year could make it harder to strike that balance.

Mr. Sacconaghi cautioned that focusing too much on profit over innovation could hurt Tesla’s edge in the sector. Growing too quickly without keeping an eye on cash flow could hurt the company’s profitability.

Tesla’s debt portfolio further complicates the task. The car maker’s debts run the gamut from asset-backed credit lines to convertible debt, and having inside knowledge of these deals will be an asset for the new CFO, analysts said.

“He’s probably more familiar with the situation than anyone,” Mr. Sacconaghi said.

Meanwhile, Mr. Kirkhorn may face a learning curve in terms of the nonfinancial duties that come with being the CFO of a public company, a role he hasn’t occupied before.

“The biggest challenge for him is building credibility with investors,” said Colin Rusch, an analyst at Oppenheimer & Co. Tesla has had the advantage of accessing low-cost capital to fuel its growth and maintaining that will be critical, he said.

Selling Wall Street analysts and investors on Tesla’s continued progress will be key to that success.

“He has to be able to speak to the investors about what the enterprise is going through in the next three to five years, and these are challenging times,” said Peter Crist, chairman at executive search firm Crist|Kolder Associates. “You have to be a storyteller.”

Write to Tatyana Shumsky at tatyana.shumsky@wsj.com