The leader of Sweden's Social Democrats says he will try to form a government after their election win, but will not work with the far right.
Results show Stefan Lofven's opposition party is set to return to power, but with no clear parliamentary majority.
They give the centre-left bloc 43.7%, ahead of 39.3% for Fredrik Reinfeldt's centre-right ruling coalition. The far-right Sweden Democrats were at 13%.
Mr Reinfeldt admitted defeat and later handed in his resignation letter.
He also confirmed that he would step down as leader of the conservative Moderate Party.
Earlier on Monday, Stefan Lofven spoke briefly to Swedish media as he left his home in central Stockholm.
"Now the work starts," he said. "We must have cooperation across bloc boundaries. Now begins the process of forging alliances between parties and not just within bloc boundaries. This is what we should do."
Mr Lofven added that he hoped to form a stable parliament, preferably with Alliance parties.
He has previously said that the Social Democrats regard the Green Party as "natural partners", but during his speech on Sunday night he said that "his hand was extended" to other democratic parties as well.
Analysis: Lars Bevanger, BBC News, Stockholm
The Social Democrats, Greens and Left Party have fallen short of a parliamentary majority. The far-right, anti-immigration Sweden Democrats have become the country's third largest party with close to 13% of the vote but Social Democrat leader Stefan Lofven has insisted he will not look to them to help form a government.
Sweden receives more asylum applications per capita than any other European country, and recently offered permanent residency to all Syrians fleeing the war there. The Swedish Democrats are the only party which opposes the country's immigration policy.
Yet all the mainstream parties still consider them to be too radical to work with.
That means the new prime minister might have to cross the floor and try to secure the votes of parties on the right of centre - the outgoing government - on a case-by-case basis.
Since coming to power in 2006, Mr Reinfeldt's coalition government has cut income and corporate taxes, abolished a tax on wealth and trimmed welfare benefits.
It has also privatised several state-owned companies, including the maker of Absolut vodka.
The results signal a return to normality in Swedish politics. The Social Democrats have not been in opposition for so long since first taking power in 1920.
With more than 99% of votes counted, the Social Democrats, Greens and Left parties looked set to win around 159 seats in the 349-seat parliament, short of a majority.
Mr Lofven told supporters in Stockholm that he would now explore the possibilities of forming a government, but would not cooperate with the Sweden Democrats.
The far-right anti-immigration party are set to become the country's third largest party.
Correspondents say they could hold the balance of power.
"We're the absolute kingmaker in parliament now," Jimmie Aakesson, leader of the far-right party, told reporters.
"You have to be able to govern this country for four years," Mr Aakesson told broadcaster SVT, "and it's going to be hard if they are not prepared to talk to us or listen to us."
But Mr Lofven insisted he would not turn to the far-right party. "We will make sure they don't get that kingmaker role," he told supporters.
The Sweden Democrats, who entered parliament for the first time in 2010, are alone in opposing the country's liberal immigration policy.
Sweden this year expects up to 80,000 asylum-seekers from Syria, Eritrea, Somalia, Afghanistan, Iraq and other countries - the highest number since 1992.
Meanwhile, results confirm that a small feminist party that had hoped to enter parliament failed to reach the 4% threshold.