Portugal's Prime Minister Antonio Costa has won re-election, however he has no outright majority in parliament.
With over half of the votes counted so far, his Socialist party led with 36.7% and will have to form a minority government.
Mr Costa said he was delighted with the result and added that voters had shown they wanted stability.
The party's rival, the centre-right Social Democratic Party, has come in second place.
Mr Costa said Portuguese voters had shown they wanted his party to continue its pact with two far-left parties - the Left Bloc and the Communists.
He said he would govern with determination and responsibility.
He also mentioned negotiations with the People-Animals-Nature party (PAN) party, Reuters reported.
While the far left has been calling for more investment in public services, Mr. Costa is expected to renew his commitment to stick to euro-zone budget rules.
Nearly 11 million people are registered to vote in the race for control of Portugal's 230-seat parliament.
The Socialists' popularity had been hit by a string of scandals, including accusations of nepotism and a suspected cover-up of weapons theft at a military base.
In 2015 the Social Democrats (PSD) won the most votes, but the Socialist Party came to power after reaching formal agreements with smaller left-wing parties.
Since then the country's economy has grown above the EU average. Cuts to public sector wages and pensions have been reversed.