Greece’s Alexis Tsipras has said his left-wing Syriza party has a “clear mandate” after winning a second general election in less than nine months.
But he said Greeks faced a difficult road and recovery from financial crisis would only come through hard work.
Syriza has won just over 35%, slightly down on its previous result.
That is again short of a majority, but Syriza will form a coalition with the nationalist Independent Greeks. Conservative New Democracy won 28%.
The far-right Golden Dawn, which is set to be the third biggest party, won 7% of the vote compared with 6.3% in the election in January when Mr Tsipras was first elected.
Sunday’s snap election was called after Syriza lost its majority in August.
Some of his MP’s defected in protest at the signing of an unpopular new financial bailout deal with international creditors and formed the Popular Unity party.
But the new party has failed to gain enough votes to enter parliament.
Turnout in Sunday’s poll was low by Greek standards at just over 55%.
Analysis: Paul Moss, BBC News, Athens
They expected victory, but not by this kind of margin. Only days ago, pollsters and pundits were predicting a tight-run contest, Syriza neck-and-neck with its conservative rivals, New Democracy. Instead, Syriza can comfortably form a coalition government with its previous partner, the nationalist Independent Greeks.
Critics wondered whether it was worth holding a contest which left Greece with the same government as before. But Syriza’s leader, Alexis Tsipras, is now in a stronger position, his decision to accept austerity measures in return for bailout cash apparently vindicated by the result.
Yet celebrations have been muted – hundreds not thousands gathering to sing, dance and wave flags. This country has more tough times ahead: tax rises, perhaps further cuts to wages and benefits. The re-elected prime minister has an in-box that no-one could envy.
“I feel vindicated because the Greek people have a clear mandate to carry on fighting inside and outside our country to uphold the pride of our people,” Mr Tsipras told supporters in Athens.
“In Europe today, Greece and the Greek people are synonymous with resistance and dignity, and this struggle will be continued together for another four years.
Mr Tsipras was joined on stage by Panos Kammenos, leader of the the nationalist Independent Greeks, who also entered a coalition with Syriza after January’s election.
“Together we will continue the struggle we began seven months ago,” Mr Tsipras said.
Greece still faces formidable economic challenges. It is in recession and the new government has to satisfy international creditors that it is fulfilling the terms of thebailout worth up to €86bn ($97bn, £61bn).
Creditors are due to review the progress of the programme in October. Some Syriza MP’s remain opposed to its terms.
Jeroen Dijsselbloem, who heads the Eurogroup meetings of eurozone finance ministers, said he was “ready to work closely” with the new Greek government.
“Now a solid government ready to deliver is needed quickly,” said European Parliament president Martin Schulz, offering his congratulations.
Near complete results give Syriza 145 seats in the 300-seat parliament, with New Democracy on 75. This is only four fewer than Mr Tsipras’s January victory.
The Greek electoral system means the party with the largest number of votes wins a bonus of 50 seats.
The Independent Greeks won 10 seats.
Greece’s turbulent year
29 Dec: Greek parliament fails to elect president, leading to snap elections a month later
25 Jan: Leftist Syriza party’s Alexis Tsipras elected PM on an anti-austerity manifesto
24 Feb: Greece’s European lenders agree to extend its second bailout by four months
Jun: Marathon talks take place to avoid Greece bankruptcy and possibly leaving the eurozone. PM Tsipras calls a referendum on a possible bailout agreement
5 Jul: Greek voters overwhelmingly reject terms of third EU bailout in referendum vote
14 Aug: Greece agrees bailout deal worth up to €86bn with its creditors – its third in five years – allowing tax hikes and new spending cuts. Mr Tsipras resigns a week later clearing the way for snap elections in September, as he seeks a new mandate
20 Sept: New Democracy concedes election defeat to Syriza
Mr Tsipras seemed to lose popularity when signing the bailout deal, shortly after holding a referendum in which more than 60% of voters rejected the austerity measures creditors wanted to impose.
In interviews leading up to the election, Mr Tsipras said he had put his country above his party. He said that had he not agreed to the three-year bailout, Greece would probably have had to leave the eurozone.