ALMOST the only thing on which Barack Obama and Mitt Romney, his Republican challenger, agree is that the economy is in a bad way. Unemployment is stuck above 8% and growth probably slipped below an annualised 2% in the first half of this year. Ahead lie the threats of a euro break-up, a slowdown in China and the “fiscal cliff”, a withering year-end combination of tax increases and spending cuts. Mr Obama and Mr Romney disagree only on what would make things worse: re-electing a left-wing president who has regulated to death a private sector he neither likes nor understands; or swapping him for a rapacious private-equity man bent on enriching the very people who caused the mess.

America’s economy is certainly in a tender state. But the pessimism of the presidential slanging-match misses something vital. Led by its inventive private sector, the economy is remaking itself (see article). Old weaknesses are being remedied and new strengths discovered, with an agility that has much to teach stagnant Europe and dirigiste Asia.

Balance your imbalances

America’s sluggishness stems above all from pre-crisis excesses and the misshapen economy they created. Until 2008 growth relied too heavily on consumer spending and house-buying, both of them financed by foreign savings channelled through an undercapitalised financial system. Household debt, already nearly 100% of income in 2000, reached 133% in 2007. Recoveries from debt-driven busts always take years, as households and banks repair their balance-sheets.

Nonetheless, in the past three years that repair has proceeded fast. America’s houses are now among the world’s most undervalued: 19% below fair value, according to our house-price index. And because the Treasury and other regulators, unlike their euro-zone counterparts, chose to confront the rot in their financial system quickly, American banks have had to write off debts and raise equity faster than their peers. (Citigroup alone has flushed through some $143 billion of loan losses; no euro-zone bank has set aside more than $30 billion.) American capital ratios are among the world’s highest. And consumers have cut back, too: debts are now 114% of income.

New strengths have also been found. One is a more dynamic export sector. The weaker dollar helps explain why the trade deficit has shrunk from 6% of GDP in 2006 to about 4% today. But other, more permanent, shifts—especially the growth of a consuming class in emerging markets—augur well. On the campaign trail, both parties attack China as a currency-fiddling, rule-breaking supplier of cheap imports (see Lexington). But a richer China has become the third-largest market for America’s exports, up 53% since 2007.

And American exporters are changing. Some of the products—Boeing jets, Microsoft software and Hollywood films—are familiar. But there is a boom, too, in high-value services (architecture, engineering and finance) and a growing “app economy”, nurtured by Facebook, Apple and Google, which employs more than 300,000 people; its games, virtual merchandise and so on sell effortlessly across borders. Constrained by weakness at home and in Europe, even small companies are seeking a toehold in emerging markets. American manufacturers are recapturing some markets once lost to imports, and pioneering new processes such as 3D printing.

Meanwhile, what was once an Achilles heel is becoming a competitive advantage. America has paid dearly for its addiction to imported oil. Whenever West Texas Intermediate climbs above $100 per barrel (as it did in 2008, last year and again this year), growth suffers. But high prices have had an effect, restraining demand and stimulating supply. Net imports of oil this year are on track to be the lowest since 1995, and America should eventually become a net exporter of gas.

Many countries have shale gas, but, as it did with the internet revolution, America leads in exploiting it (see our special report this week). Federal money helped finance development of the “fracking” technology that makes shale gas accessible, just as it paid for the internet’s precursors. However its use was commercialised by a Texas wildcatter called George Mitchell, the sort of risk-taker America has in abundance. In Europe shale gas has been locked in by green rules and limited property rights. In America shale has already lowered consumers’ energy bills and, by displacing coal, carbon emissions. In future, it will give a spur to the domestic manufacture of anything needing large amounts of energy.

America’s work-out is not finished. Even when the results are more visible, it will leave many problems unsolved. Because the companies leading the process are so productive, they pay high wages but do not employ many people. They may thus do little to reduce unemployment, while aggravating inequality. Yet this is still a more balanced and sustainable basis for growth than what America had before—and a far better platform for prosperity than unreformed, elderly Europe.

Of cliffs, and other perils

What should the next president do to generate muscle in this new economy? First, do no harm. Not driving the economy over the fiscal cliff would be a start: instead, settle on a credible long-term deficit plan that includes both tax rises and cuts to entitlement programmes. There are other madnesses brewing. Some Democrats want to restrict exports of natural gas to hold down the price for domestic consumers—a brilliant strategy to discourage domestic investment and production. A braver Mr Obama would expedite approval of gas exports. For his part, Mr Romney should back off his promise to brand China a currency manipulator, an invitation to a trade war.

Second, the next president should fix America’s ramshackle public services. Even the most productive start-ups cannot help an economy held back by dilapidated roads, the world’s most expensive health system, underachieving union-dominated schools and a Byzantine immigration system that deprives companies of the world’s best talent. Focus on those things, Mr Obama and Mr Romney, and you will be surprised what America’s private sector can do for itself.