Imagine a country, a major Western economic power, where the coronavirus arrived late but the government, instead of denying and delaying, acted early. It was ready with tests and contact tracing to “flatten the curve” swiftly and limited its death rate to orders of magnitude lower than that of any other major Western industrial nation. Containing the virus allowed for a brief and targeted lockdown, which helped limit unemployment to only 6 percent. Amid a shower of international praise, the country’s boringly predictable leader experienced a huge spike in popular approval, to 70 percent from 40 percent.

This mirror image of America under President Trump is Germany under Chancellor Angela Merkel. Her surging popularity has politically marginalized the extreme right and extreme left. German unions have worked closely with bosses to keep factories open and working conditions generally safe (the country’s meatpacking industry was a notable exception). Ms. Merkel’s government has coordinated with all the German states to contain the pandemic and with fellow European Union members to establish a recovery fund for nations hardest hit by the virus.

The strengths Germany is showing make it the large economy most likely to thrive in the post-pandemic world.

The coronavirus pandemic has revitalized Angela Merkel and burnished her reputation as one of the country’s best leaders. Credit…Pool photo by John Thys

The coronavirus is accelerating an inward turn among national economies that began with the global financial crisis of 2008. Governments are assuming more and more control over all aspects of economic life, running up public debts to keep growth alive and imposing new barriers to foreign trade and immigration. Only the virtual side of the world economy is booming, as people work, play and shop on the internet.

Which nations will flourish in this reshaped economic landscape? Despite their tech dominance, the United States and China are running up too much debt and their governments have been widely criticized for mishandling the pandemic. Vietnam looks promising, an emerging export powerhouse with a government that has stopped the virus dead in its tracks. Russia also has an intriguing economy, because President Vladimir Putin has been working for years to seal off his country from foreign financial pressure, a defensive move that will prove increasingly valuable in a rapidly de-globalizing world.

But the big winner is likely to be Germany. Its response to the pandemic has highlighted pre-existing strengths: efficient government, low debt, a reputation for industrial excellence that protects its exports even as global trade falls, and a growing capacity to create domestic tech companies in a world dominated by the American and Chinese internet giants.

While other countries worry that recent layoffs may become permanent, most German workers stayed on the payroll thanks to rapid expansion of the Kurzarbeit, a century-old government system that pays companies to retain employees on shortened hours through temporary crises. Germany was able to expand the Kurzarbeit — and much else in the way of social services — thanks to its famous frugality. During the long years when Ms. Merkel was pressing austerity on fellow European Union members, they lampooned her as a “Swabian housewife,” an archetype of the thrifty German who saves stale bread for dumplings. They aren’t laughing now.

Because Germany went into the pandemic with a government surplus, it could support its locked-down economy with direct payments to families, tax cuts, business loans and other aid amounting to 55 percent of gross domestic product, or roughly four times more than the United States’s rescue package as a share of G.D.P. It was also able and willing, for the first time, to provide emergency stimulus funds to neighboring countries that have long complained that German stinginess hurt the entire continent. That move was shrewd as well as generous: Those countries are now better able to afford German exports than they would have been.

Yet Germany is not dropping its commitment to balanced budgets. Since much of this spending will be drawn from savings, Germany’s public debt is expected to rise, but only to 82 percent of G.D.P. — a much lighter debt burden than that of the United States and other highly developed countries, which are spending far less on economic rescue packages.

Doubters say that Germany is now dangerously reliant on industrial exports, particularly to China, in a time of slowing global trade. Well aware of these vulnerabilities, Germany is pushing to modernize its leading exporters, the big car companies. Through regulation and public shaming, it is pressuring the carmakers to turn from the still highly profitable combustion engine to the electric cars of the future. Stuttgart, home to Porsche and Mercedes-Benz, has banned older diesel motors within city limits.

Germany is also making a big if somewhat belated push to become a more competitive tech power. It devotes as much to research and development as the United States does (around 3 percent of G.D.P.) and has a long-term plan to create an entrepreneurial ecosystem akin to Silicon Valley, in which venture capitalists fuel promising start-ups. Germany’s technology industry is not without its setbacks, such as the recent and sudden collapse of the financial technology company Wirecard, which has raised questions about the vigilance of Germany’s financial regulator. But many of the industry’s first successes, copies of American online-shopping and food-delivery companies, are scaling up rapidly.

The German economic rescue plan includes $56 billion for start-ups that can digitize traditional industries, using artificial intelligence and other new technologies. Alongside France, Germany recently announced what its economics minister called a digital “moonshot,” which aims to create a European internet cloud to rival those of America and China.

Germany is an aging, conservative society, but critics who assume it is too slow to change have been proved wrong before. In the early 2000s, when Germany was dismissed as the proverbial “sick man of Europe,” it adopted labor market reforms that restored its status as the continent’s most stable economy. As the pandemic accelerates the pace of digitalization and de-globalization and drives up the world’s debts, Germany stands out for its relative lack of weakness to those challenges, and for a government prepared to handle them.

Ruchir Sharma is the chief global strategist at Morgan Stanley Investment Management, the author, most recently, of “The Ten Rules of Successful Nations” and a contributing Opinion writer. This essay reflects his opinions alone.