FRANKFURT — The German carmaker Daimler slipped into the red at the end of 2019, battered by the cost of developing electric cars and by penalties from diesel emissions cheating.

The collapse of profit, which Daimler had warned about last month, exemplifies the challenges facing the German car industry, which may be serious enough to push the country into recession. Vehicles are the country’s biggest export, as well as an important part of the national identity.

The quarterly loss of 11 million euros, or $12 million, was relatively small compared to a profit of €1.6 billion in the fourth quarter of 2018. But it puts Daimler, the maker of Mercedes-Benz cars and trucks, in a weak position as it confronts the economic consequences of the coronavirus in China.

Daimler and other carmakers were forced to keep their factories in China closed longer than planned after the Lunar New Year, and the virus has kept people out of showrooms. On Monday, the company said it had begun gradually ramping up production at its Chinese factories.