António Costa, Portugal’s prime minister, is unique among Europe’s socialist leaders: he is popular, in power and pursuing a successful alternative to austerity. While populism, nationalism and the financial crisis have eviscerated southern Europe’s other centre-left parties, Costa’s Partido Socialista (PS) enjoys a 13-point opinion poll advantage and his minority government is feted by EU leaders.

The year before the 2016 Brexit vote and the election of Donald Trump, Portugal became one of the first Western democracies to enter unknown political territory – albeit, for once, in an encouraging direction for Europe’s enfeebled left.

An unexpected detente between rival left-wing parties followed the inconclusive outcome of the October 2015 general election. The centre-right coalition that had imposed a punitive austerity programme, overseen by the EU and the International Monetary Fund, won the most seats but lost its working majority in parliament. Costa, whose PS finished second, defied constitutional precedent by negotiating an anti-austerity pact with the radical Left Bloc (BE) and the Portuguese Communist Party (PCP).

The new prime minister described the alliance as “tearing down the last remains of a Berlin Wall”. Costa’s pact was dubbed the geringonça: an odd contraption.

Few predicted this realignment. Nor was it expected to last. Yet more than two years later, Portugal’s “left-wing exceptionalism”, as political analyst Federico Santi describes it, is in robust health.

European parliamentarians applauded Costa on 14 March when he spoke of how an anti-austerity alliance between the mainstream and radical left had shielded Portugal from right-wing populism. “What sets democratic politics apart from populism is that it does not tap into people’s fears… but instead gives them back hope in the future,” Costa told MEPs at the European Parliament in Strasbourg.

The coalition government has functioned better than even its creators could have hoped. Since the PS administration entered office in November 2015, Portugal has, for the first time this century, caught up with the rest of Europe: economic growth last year reached a 17-year high of 2.7 per cent, above the eurozone average of 2.5 per cent. More than 270,000 jobs have been created over the last two years, while unemployment, which peaked at 17 per cent in 2013, fell below 8 per cent in December 2017 for the first time in more than 13 years.

The government has increased state pensions, the minimum wage and public sector pay while cutting taxes and improving welfare benefits for the lowest-paid. Costa has achieved this at the same time as complying with the EU’s strict fiscal rules, which prohibit budget deficits of more than 3 per cent of GDP. Government borrowing has been reduced to 1 per cent; the lowest figure since the restoration of Portuguese democracy in 1974.

The analyst Santi, of Eurasia Group, is one of many sceptics who predicted an early collapse of the pact or an intractable feud with Brussels. “We underestimated the extent to which the parties on the left were invested in making the alliance work,” he says now.

The geringonça operates on the simple principle that the three parties agree only on the fundamentals of their programme, such as the rejection of austerity. In all other policy areas, they are free to oppose and criticise each other. The deal ensures a working parliamentary majority for the PS (which has 86 seats); the BE (19 seats) and the PCP (15 seats) hold no government positions. This liberates them to condemn Costa’s administration when necessary and maintain credibility with their voter bases. As Antonio Barroso, an analyst for Teneo Intelligence, puts it: “There’s no better way to assert yourself as anti-establishment than not joining the establishment.”

The international context has also helped. Francisco Louçã, who co-founded the Left Bloc in 1999, describes Costa as “the luckiest man in the world” because he took power as the global economic recovery accelerated, boosting Portuguese exports and reducing oil prices. But Louçã also lauds Costa’s fiscal stimulus measures and his decision to challenge austerity with “a policy consistency that voters recognise”.

The popularity of the government, Louçã says, “springs from relief” after the painful 2011 bailout (which led to the biggest public spending cuts in 50 years) and a deep recession. However, he also cautions that “relief is not a policy”. Though returning public sector wages and pensions to pre-bailout levels has helped promote economic growth, meeting EU fiscal targets has led to “a drastic reduction in public investment”.

Louçã, an economics professor who left the BE leadership in 2012 (terms are limited to ensure constant renewal), believes the survival of the left pact depends on developing a long-term strategy that goes beyond providing immediate relief from austerity. This, he says, would include reforming labour contracts, increasing industrial capacity and creating high-skilled jobs that pay young engineers more than €700 a month.

The Portuguese exception has its vulnerabilities. In contrast to Britain as well as the rest of southern Europe, there has been no repoliticisation of the young; just over half the electorate turns out to vote. “Portugal is always the outlier in southern Europe in terms of political participation and there is no sign this is going to change,” says Barroso.

Reproducing Portugal’s successful formula elsewhere is not easy. “The absence of a far-right party, the fact that the PS were in opposition during the bailout and the willingness of the radical parties to work with the moderates is not the case in most other countries,” says Santi. “Rather than a template for other parties to follow, I see Portugal as the exception that proves the rule, what some people see as an irreversible crisis of the moderate left.”

Peter Wise is the FT’s Portugal correspondent