Sales of the company’s cars are flagging, but investors are focusing on the potential of autonomous driving and Mr. Musk’s ties to President-elect Donald J. Trump.
President-elect Donald J. Trump is expected to roll back many of the rules and subsidies that have attracted billions of dollars from the private sector to renewable energy and electric vehicles.
Fewer people will be able to afford electric cars and trucks if President-elect Donald J. Trump and Republicans in Congress eliminate a $7,500 federal tax credit.
The American automaker said the cost-cutting measure would help it compete with Chinese rivals in the face of slowing demand for electric vehicles.
Mr. Musk dug into his companies’ budgets, preferring to cut too much rather than too little and to deal with the fallout later. Under Donald Trump, he is set to apply those tactics to the U.S. government.
The new agreement builds on an earlier announcement in which the German automaker said it would invest up to $5 billion in Rivian, a maker of electric vehicles. The new venture brings them closer.
Ford is struggling to make money on battery-powered models while General Motors, which started more slowly, says it is getting close to that goal.
The electric car company said profits climbed 17 percent in the third quarter as strong sales of energy products helped to make up for relatively slow auto sales.
Mary Barra, G.M.’s chief executive, said that the company had fixed battery-manufacturing problems and that its electric vehicles would soon be profitable.
The automaker reported a gain of 6.4 percent for the latest quarter, its first such increase this year.