Portugal's governing right-of-centre Democratic Alliance has won snap parliamentary elections - the third in as many years - again falling short of a majority.
Its leader Luís Montenegro promised supporters to "stimulate investment" and to "guarantee prosperity and social justice".
Socialist leader Pedro Nuno Santos announced his resignation after his party finished in second, and lost so many seats it ended up neck-and-neck with far-right Chega - a relatively newcomer.
The Socialists could even slip behind Chega if results from voters abroad, which take a few days to come in, mirror those in last year's election, when two out of the four seats went to Chega, and one to the Socialists.
Chega leader André Ventura said the "historic" result marked the end of two-party dominance in Portugal.
His campaign had focussed on the issues of immigration and corruption, and Chega was probably helped by the fact that this election and the previous one were both triggered by scandals involving the prime minister of the day.
Montenegro, in his remarks to supporters, thanked both his family and the "political family" that defended him from attacks relating to deals done by a company he set up before he became party leader, and which is now owned by his sons.
This was the controversy that triggered the election, after the government lost a vote of confidence.
Meanwhile, Santos, in his own parting comments, reiterated his view that Montenegro was not fit to be prime minister, suggesting that the Socialist Party should not let the matter drop.