With 99.1% of the vote counted, the AD won 79 seats in the 230-seat legislature, followed by the Socialists with 76 seats, prompting them to concede defeat.

Chega, meaning enough, came third, quadrupling its parliamentary representation to 48 lawmakers after campaigning on a clean governance and anti-immigration platform.

Chega voters said before the poll that the country was in a bad way and they wanted changes in housing, education, healthcare and justice in western Europe's poorest country.

AD and Social Democrats leader Luis Montenegro told reporters on Sunday that he expected President Marcelo Rebelo de Sousa to formally invite him to form a government ahead of a March 15 deadline.

He said he hoped the PS and Chega would not form a negative alliance to prevent the government the Portuguese people wanted.

Chega's leader Andre Ventura told reporters the vote clearly showed that the country wants a government of the AD with Chega.

Eurointelligence consultants said the result marked a new political chapter in Portugal after alternate governance by two mainstream parties for the past 50 years.

It said the AD would have to either seek the backing of Chega or the Socialists for a minority government, or invite them into a coalition.

"The Alliance excluded the first option on the campaign trail. The Socialists excluded the second option. Something will have to give," they said.

TILT RIGHT

The election result underscored a political tilt to the far right across Europe and a dwindling of Socialist governance.

Chega has since 2020 been part of the European Parliament's Identity & Democracy group, which is expected to see gains in European elections in June.

Spain's far-right VOX congratulated Ventura on social media platform X.

"Patriots are making their way in defence of freedom and sovereignty of nations against corrupt socialism and outdated bipartisanship," it said.

Matteo Salvini, leader of Italy's co-ruling League party hailed Chega's "extraordinary result, alone against everyone", in a statement late on Sunday.

Portugal's PSI stock index fell 0.3% at open in line with a decline by European peers before flattening out.

"The impact of the elections on the market turned out to be nil and we can assume that it was a 'non-event' for the markets," XTB market analysts said in a note.

"Even so, it's important to realise that the fact that the AD doesn't have a majority and needs to form coalitions with other parties in order to govern with a majority could be a risk factor if signs of instability start to appear again. In this scenario, we can't rule out a negative reaction from the Portuguese stock market," they added.

Under Socialist leadership since late 2015, Portugal has grown at solid annual rates above 2%, except for the pandemic-induced slump of 2020. It has posted budget surpluses lately, using the cash to slash public debt below 100% of GDP and winning praise from Brussels and investors.

(Reporting by Patrícia Vicente Rua; Editing by Aislinn Laing and Ed Osmond)