In Lisbon, PS member Fernando Medina was voted out as mayor in favour of Carlos Moedas in a result that surprised many.

Overall PS won for the third consecutive time in local councils, but fell short of the 2017 result, while António Costa, who tried to playdown the defeat in the capital, saying that "the country is not Lisbon".

In his victory speech, Carlos Moedas claimed to have won “against everything and everyone”, because “democracy has no owner”.

At his side were the leaders of the two main parties that supported him, Rui Rio, from the PSD, and Francisco Rodrigues dos Santos, from the CDS-PP. Both claimed good results on election night.

In a festive atmosphere, Rui Rio admitted that it was an “excellent result” and that the party is in “better conditions” to win the next legislative elections.

At the time he was talking to journalists, the PSD had recovered 31 councils that it did not lead in 2017 and lost 15, which, he said, "is better than in 2017 and better than in 2013."

At 03:00, the PSD, alone, registered victories in 71 municipalities, to which there were another 38 in coalition, in a total of 109 municipalities.

Francisco Rodrigues dos Santos argued that the electoral results achieved during his term "speak for themselves" and expressed hope that from now on they can "value the work that has been done".

In alliance with the PSD in several municipalities, the CDS won in five chambers, one less than in 2017.

On the left, the CDU, a coalition led by the PCP, failed to “assault” Almada, the council that became socialist in 2017 and will continue to be so.

The final results dictated other losses for the communists, such as Mora, Montemor-o-Novo, Alvito and Loures to the PS, and also Vila Viçosa. Jerónimo de Sousa, general secretary of the PCP, assumed that the results were “beyond the stated objectives” and that the CDU had “a lot to evaluate”.

As for the Left Block, it continued without gaining any city council, managing to elect councillors. Around 05:00, the election of a councillor in Lisbon and another in the municipality of Porto was confirmed.

In Coimbra, the PS lost the Câmara to José Manuel Silva, of the Juntos Somos Coimbra coalition (PSD/CDS-PP/NC/PPM/A/RIR/VP), while a few kilometres away, in Figueira da Foz, the Socialists also lost the chamber for Pedro Santana Lopes, former mayor and former prime minister, who defeated the candidate of the party he led, the PSD.

To the north, Rui Moreira's list of independents won, but lost the absolute majority, in elections in which the PS and PSD were far removed from the current mayor.

Of the parties with a parliamentary seat, People-Animals-Nature (PAN) failed on Sunday to elect a councillor in chambers.

Chega managed to elect 19 councillors, obtained 205,000 votes and the Liberal Initiative failed to elect councillors and collected 63,000 votes.

In the balance of district capitals and autonomous regions, the PSD leads in nine of the 18 districts, starting with the capital, Lisbon, Funchal, Madeira, which was won by the PS, and in Ponta Delgada, Azores, which remains orange.

The PS gets six district capitals, the CDU two and there is only one led by a list of independents, Rui Moreira, in Porto.

More than 9.3 million voters could vote on Sunday in local councils, to which more than two dozen parties and more than 60 citizen groups presented themselves.

In these elections, abstention remained high – 46.3%, when 99.5% of the votes were counted, at 4:45 am.