Brazilian leftists heaved a huge collective sigh of relief on Sunday night after Jair Bolsonaro – the homophobic, dictatorship-praising far-right front-runner – fell just short of a stunning first-round victory that would have made him president of one of the world’s largest and most diverse democracies.

Their relief may well be short-lived.

Fernando Haddad, Bolsonaro’s opponent in the pivotal second-round vote on 28 October, has a mountain almost as high as Brazil’s Pico da Neblina to climb if he is to scupper the right-wing populist’s dramatic political ascent.

Bolsonaro secured more than 49m votes on Sunday – 46% of the total and just shy of the majority he needed for an outright win – while his Workers’ party (PT) opponent won just 29%, or 31m votes.

Just to draw level with Bolsonaro, Haddad would need virtually every single one of the voters who opted for the third and fourth-placed candidates, Ciro Gomes and Geraldo Alckmin, to switch to his side.

“The path for Haddad to close that gap looks almost impossible,” said Brian Winter, the editor-in-chief of Americas Quarterly, describing Bolsonaro as a “huge favourite” to win. “If you simply add Bolsonaro plus two-thirds of Alckmin’s [5m] votes, it’s over.”

Those hoping Haddad can still win believe he must now position himself as a centrist champion of democracy who can prevent Brazil from lurching back towards the kind of murderous, authoritarian rule Bolsonaro has so often said he admires.

Heloísa Starling, a Brazilian historian, said she believed Haddad now needed to piece together “a great democratic coalition” if Brazil was to avoid being hurtled back towards “tyranny”. “It can’t just be a left-wing coalition – it must include everyone who is prepared to defend democracy, whoever they may be,” Starling said.

James Green, the head of Brown University’s Brazil Initiative, agreed an “anti-fascist front” was essential if Bolsonaro was to be stopped.

Defeated candidates such as former environment minister Marina Silva would come under pressure to align themselves with that pro-democracy bloc, irrespective of their bad blood with the PT, he said. “That is really going to mark the political lives of many people – which side they are on in the second round.”

Already on Sunday night there were signs Haddad would seek to do just that.

“I’ve always been on the side of freedom and democracy. I’m not going to give up my values,” the 55-year-old intellectual tweeted, claiming he had already spoken to three of the defeated candidates and was open to “dialogue”.

Workers’ party candidate Fernando Haddad alongside vice-presidential candidate Manuela Davila. Photograph: Anadolu Agency/Getty Images

Gomes, who came third with 12.5% of the vote and potentially has the most support to transfer to Haddad, said it was too early to say what he would do. But he ruled out support for Bolsonaro – “Not him, definitely!” – and said he was “anguished” by the direction his country was taking. “One thing I can tell you right now [is that I hope] … to carry on doing what I have done my whole life: fighting for democracy against fascism ” Gomes told reporters.

Winter, however, said he was doubtful such an alliance would be enough: “This is the path [PT leaders] see. They really want to make a big case for democracy. But I don’t think it will resonate.”

“Haddad is going to tack to the centre – a bit – he’s going to make an appeal for democracy,” Winter predicted. “But it’s not clear there is anybody left in the centre and democracy has become a bad word in Brazil. It’s a synonym for weakness and chaos and leniency with criminals and I just think those appeals for democracy are going to fall on mostly deaf ears.”

Nor was it likely that Bolsonaro – whose three-decade political career has been peppered with incendiary remarks that in recent years appear to have only added to his appeal – could damage his own campaign with an indelicate comment.

“Most people backing Bolsonaro know exactly what he is about at this point”, just as most Trump voters were well aware of the kind of man they were electing, Winter said.

In a celebratory Facebook broadcast on Sunday night, Bolsonaro warned Brazil was on the edge of a corrupt, communist “abyss” and could take one of two paths.

One was his path of “prosperity, freedom, family” and godliness. The other was Haddad’s: “the path of Venezuela”.

“We do not want this type of people re-occupying the Palácio do Planalto,” Brazil’s presidential palace, Bolsonaro warned of Haddad’s PT.

Sunday’s results suggest most Brazilians agree.