The latest data on Germany’s economy are surprisingly grim. Industrial production fell sharply in November, and the country is on the brink of a technical recession. Its government should get ready to loosen fiscal policy if output doesn’t bounce back soon.

November’s 1.9 percent month-on-month decline in industrial production followed a 0.8 percent drop in October. The economy’s overall output fell by 0.2 percent in the three months to September, so some economists now fear the eurozone’s largest economy could be heading for two quarters of contraction. To be sure, it might be a hiccup. German carmakers have been slow to adapt to new emission tests that became compulsory in September, causing delays in production. A warmer-than-expected November held down energy production. A public holiday fell in such a way as to encourage workers to take additional time off. Optimists including Germany’s central bank think the economy is still in good health.

It would be wrong to take this for granted. The economy depends on exports, so the slowdown in China and the U.S.-China trade dispute could cause long-lasting damage. Other big eurozone economies may be stuttering, too, thanks to the protests in France and uncertainty over policy in Italy. This could further weaken demand for German exports.

If the slowdown goes on, Berlin could afford to launch a sizable fiscal stimulus. In its 2019 budget, the government planned for public debt to fall below 60 percent of gross domestic product this year, well under the post-crisis peak of 81 percent. Germany’s 10-year bond yields are close to zero, so the government’s cost of borrowing is less than zero in real terms even for longer-term debt.

Germany needs more public investment in any case. Infrastructure has been poorly maintained for years. According to an estimate by the think tank Bruegel, the value of Germany’s public-sector capital has decreased by almost 7 billion euros since 2007, even as the economy expanded by nearly 30 percent.

A German stimulus would also relieve some of the pressure on the European Central Bank, which just stopped providing monetary stimulus through net asset purchases. Many in Germany opposed quantitative easing, arguing that the policy defied the central bank’s mandate. More active fiscal policy would make it less likely that asset purchases would have to resume.

An instinct for fiscal conservatism is the reason Germany now has room for fiscal maneuver — but this is only a virtue if fiscal space is used when needed