AT THE beginning of April international investors made two whopping bets by snapping up the first ever 100-year bond denominated in euros. The first bet was that the euro would still exist a century from now. No bookie would give short odds on that. The second was that the issuer, Mexico, which suffered three long cycles of boom and bust in the past century, would continue to be creditworthy for the next 100 years.

Mexicans, whose country has, as one economic historian puts it, lived longer in moratoria than with access to capital markets, reacted with bemusement. A typically gloomy columnist predicted that, since Mexico will have run out of oil by 2115, it will have to sell off the country’s extremities to repay the bondholders.

Foreign creditors are more bullish. Over the past five years they have extended the equivalent of more than $5 billion of 100-year bonds to Mexico in three currencies: dollars, sterling and now euros. It is the only country to have tapped the so-called centennial market since China and the Philippines in the 1990s, and it has done so at relatively low yields—of 6.1% on its dollar bond in 2010 and just 4.2% on its euro bond last month. Those are extraordinarily good terms given Mexico’s distinctly spotty credit record (see chart), which raises two questions.

How has Mexico managed to pull off this “sale of the century”? And what are the chances of investors, or their grandchildren, getting their money back?

The answer to the first question is a combination of salesmanship and timing. The finance ministry’s bright, American-educated technocrats know how to attract attention from investors who may not have considered Mexico before. The euro-denominated bond, for instance, was sold largely to insurance companies and annuity firms. One advantage of its long life, for borrower and creditors alike, is that it helps avoid the sort of overcrowded redemption schedules that contributed to Mexico’s debt crises in 1982-83 and 1994-95.

But in an era when the yields on the bonds of many rich countries are negative, Mexico’s main selling-point is a relatively high return for a borrower that last year received an “A” rating from Moody’s. On the day Mexico issued its euro-denominated centennial bond, Switzerland sold a ten-year bond at a negative yield—a first.

Mexico also stands out from other emerging markets in several ways. Although the halving of the oil price has hurt the public finances, the peso has done better than many of its peers.

Agustín Carstens, the governor of the central bank, says Mexico has an “arsenal” of $195 billion of international reserves and a $70 billion credit line from the IMF in case of financial-market volatility. That has helped to attract outsiders: foreigners hold 2.2 trillion pesos ($144 billion) of domestic debt.

The government has further impressed investors by tightening its belt before times get tougher. It has cut spending in an election year and is attempting to implement a string of reforms aimed at bolstering competition in areas like energy and telecommunications that have the potential to attract large sums of foreign direct investment. “Mexico is a bright spot among emerging markets. It is one of the few countries that has been fixing the roof while the sun shines,” says Andrew Stanners of Aberdeen Asset Management, a big investment fund.

So why are few Mexicans so sanguine? Gerardo Esquivel of El Colegio de México, a university, describes the government’s approach with a different home-improvement analogy. He likens it to “putting a bright coat of paint on the exterior of the house, while the inside is rotting away”.

The problem, he says, is that the 20 years of macroeconomic stability and flexible exchange rates that have endeared Mexico to foreign creditors have been accompanied by meagre, narrowly based growth that depends heavily on exports.

Growth in output per person has averaged about 1% a year since 1995. Poverty levels have remained stagnant. President Enrique Peña Nieto initially promised his reforms would bring annual growth of 5-6%; his government has since had to lower its forecasts repeatedly. Private-sector economists think growth will average 3.8% over the next decade, according to a poll from the central bank.

The strength of Mexico’s exports to America—especially cars—has not translated into booming domestic demand due to decades of miserly wages, economists say. A huge, unproductive informal sector and general lawlessness also drag the economy down. The “pressure cooker effect” of low growth, low wages and rising inequality of income and opportunity could explode, according to Mr Esquivel. “The Peña Nieto administration doesn’t understand this. They still talk in terms of trickle-down.”

The government disputes this. Alejandro Díaz de Léon, the finance ministry’s point man on the latest 100-year bond, acknowledges that Mexico has underperformed in terms of growth. “Productivity, job creation and wealth creation are the key issues for the future,” he admits.

But he says the president’s reforms aim to address them. Moreover, he argues, the lessons learned from Mexico’s past booms and busts are so embedded among politicians and officials that there is little chance of a slide back into financial chaos. He points to Mexico’s independent central bank, open financial markets and free-trade agreements as guarantors of stability.

Demography is another card played by the optimists. A whopping 46% of the population is under 25. Luis de la Calle, an uncharacteristically upbeat Mexican economist, says this alone could turn Mexico into one of the world’s biggest economies within the next few decades. He believes that the country will soon rue its 100-year issuance at 4%, because it will be able to borrow far more cheaply.

“We’ll prepay that bond, no doubt,” he says.

Whether countries repay their debts comes down to questions of political will as much as economic performance, however. Some fret that Mexico’s past will return to haunt it. The country inherited a habit of default from the Spanish empire, which reneged on its debts more than a dozen times between the 16th and 20th centuries. Mexicans have also alternated repeatedly between an embrace of globalisation and a reversion to an inward-looking nationalism.

For the first decade of the 20th century, for instance, international bankers threw money at Mexico because of its macroeconomic stability, its railway boom and a global liquidity glut.

Then came the murderous revolution of 1910, which erupted partly because the fruits of that prosperity had not been shared. Mexico defaulted on its debt in 1914. It was shut out of capital markets for most of the next three decades. It did not become a big borrower again until the 1970s. For bondholders to get their money back in 2115, Mexico must defy its history and remain open to trade and foreign capital.