HIS supporters celebrated like the fans of a football team that had won an upset victory in a cup final. Car horns blared. Firecrackers lit up the sky. Yells of “vamos!” rang out among Buenos Aires’s Parisian-style apartment buildings. But the upset they were cheering was political, not athletic. On November 22nd Mauricio Macri, the mayor of the city of Buenos Aires, narrowly defeated Daniel Scioli, governor of Buenos Aires province, in a run-off to become Argentina’s next president.

The result is hugely significant, not just for Argentina but for South America. Mr Scioli ran as the heir of the country’s current president, Cristina Fernández de Kirchner, a charismatic but divisive populist. The election of Mr Macri, who campaigned under the banner of a coalition of parties called Cambiemos (“Let’s Change”), represents a repudiation of her legacy. He will be the first president in nearly a century who is neither a Peronist nor a member of the movement’s weaker rival, the Radical Civic Union.

For the past dozen years Ms Fernández and her husband (and predecessor as president), Néstor Kirchner, who died in 2010, have imposed controls on Argentina’s economy, which have crimped production and gradually pushed up inflation. They aligned the country with authoritarian regimes and tried to undermine independent institutions such as the media, the judiciary and the Central Bank. Mr Macri promises a return to economic, democratic and diplomatic norms.

His victory, by a margin of around three percentage points, looked unlikely until a month ago. Despite a sagging economy and allegations, which she denies, of self-enrichment while in power, Ms Fernández remains relatively popular. Mr Scioli thought her endorsement and the backing of the Peronist movement would bring him victory. By comparison, Mr Macri, a former president of the Boca Juniors football team and the son of a tycoon, looked like an outsider. He launched his centre-right party, Republican Proposal, just a decade ago. Until this year it had little presence outside the capital.

In the first round of voting in October Mr Macri came a surprisingly close second to Mr Scioli. That gave Mr Macri’s campaign a jolt of energy. In the second round he inherited much of the support that had gone to Sergio Massa, a dissident Peronist, in the first. He persuaded Argentines that his promise of change applies to the parts of kirchnerismo they don’t like, not to the ones they do, such as Ms Fernández’s generous welfare programmes and the nationalisation of YPF, an oil giant.

In some respects, Mr Macri will be able to set a new tone as soon as he is inaugurated on December 10th. His leadership style will be less confrontational than Ms Fernández’s. He will move quickly to shake up the statistics agency, which has been issuing misleading reports on inflation and poverty, and is expected to signal his commitment to judicial independence by naming unimpeachable candidates to fill two vacancies on the Supreme Court.

INTERACTIVE: 12 years of Argentina's election history

Fixing the economy, which has barely grown since October 2011, will be harder. The inflation rate has risen to around 25%, the peso is overvalued and the fiscal deficit is expected to be at least 6% of GDP this year. To put Argentina back on a path to growth, Mr Macri needs to dismantle the draconian currency and trade controls imposed by Ms Fernández in 2011 to prevent capital flight. The “clamp” on the purchase of foreign currency by individuals and businesses created an unofficial dual exchange-rate regime. That must now be unified by means of a devaluation. To keep the peso from falling too fast, Mr Macri must quickly find dollars, which are in short supply. “The Central Bank’s firepower is essentially zero,” says Luis Secco of Perspectiv@s, a consultancy. On November 21st the Central Bank told commercial banks to sell two-thirds of their dollar holdings to reinforce its own foreign-currency reserves.

The simplest way to raise dollars is to borrow on international markets, but for Mr Macri that will not be easy. To raise funds at reasonable rates, the government must reach an agreement with bondholders who had pushed Argentina into a default in July 2014. But such an agreement requires the consent of Congress, where Mr Macri’s party and its allies are in a minority. The new president’s success will depend greatly on whether he can attract the support of some Peronists in Congress. His narrow margin of victory could make that harder.

He will have an easier time reorienting Argentina’s foreign policy. Mr Macri wants to “rebalance” relations away from China, Venezuela, Russia and Iran and towards normal relations with the United States and Europe. He says he will call on Mercosur, a six-country South American trade grouping, to invoke its democracy clause to suspend Venezuela from membership unless the parliamentary election there on December 6th is conducted democratically and opposition political leaders are released from prison. No other Latin American president has been so outspoken. His victory leaves Venezuela looking much more isolated.

In turning to a politician of the centre-right to lead the country, Argentina may be setting a precedent for the rest of the region. The normal desire of voters in democracies for an alternation of power is now playing against the incumbent governments of the left. Brazil’s left-wing president, Dilma Rousseff, is deeply unpopular. The party that leads Venezuela’s radical socialist regime is likely to be defeated in next month’s election. Mr Macri’s victory may thus mark the ebbing of the “pink tide” that has washed over the region since the early 1990s.

South America is not about to go back to the past. The left put inequality on the region’s agenda and it is likely to remain there. But other issues are now equally pressing: clean government and a return to rapid economic growth. In Argentina the centre-right now has a chance to make these issues its own. Mr Macri’s victory may well be the shape of things to come.