Both the premier's three-party, left-wing bloc and the opposition centre-right Alliance of four parties were each seen taking 143 of 349 seats in parliament, but both would fall well short of the 175 needed for a majority.
Opposition leader Ulf Kristersson of the conservative Moderates has vowed to foil Lofven's attempts to form a government, intent on building his own centre-right coalition.
The far-right Sweden Democrats, who have capitalised on voters' frustration over immigration after the country welcomed almost 400,000 asylum seekers since 2012, were seen making steady gains, rising from 12.9 per cent in 2014 to 17.7 per cent.
"We have strengthened our role as kingmaker.... We are going to gain real influence over Swedish politics," Sweden Democrats leader Jimmie Akesson told cheering supporters at an election night party.
The Sweden Democrats remain the third-biggest party -- failing to overtake the Moderates who were credited with 19.8 percent of the vote.
The Sweden Democrats score was however below the 20 to 30 per cent Akesson had hoped to win.
Marine Le Pen of France's far-right National Rally -- formerly known as the National Front -- hailed the Swedish party's rise, tweeting: "Yet another bad night ahead for the European Union. The democratic revolution in Europe is moving forward!"
Lofven had called the election a "referendum on the future of the welfare state", but the far right presented it as a vote on immigrants and their integration.
The Sweden Democrats, with roots in the neo-Nazi movement, have said the large number of asylum-seekers presents a threat to Swedish culture and claim they put a strain on the country's generous welfare state.
Around 18.5 per cent of Sweden's population of 10 million was born abroad, according to Statistics Sweden.
Lofven had urged Swedes not to vote for what he called a "racist party" as he cast his ballot Sunday.
"It's... about decency, about a decent democracy. And the Social Democrats and a Social Democratic-led government is a guarantee for not letting the Sweden Democrats extremist party, racist party, get any influence."
The Social Democrats have led a minority government with the Greens since 2014, with the informal support of the ex-communist Left Party to pass legislation. The Social Democrats' result was its worst showing in a century.
Mattias, a Stockholm resident at an election night party in the city, said he was "extremely concerned" about the far right's steady climb since it entered parliament in 2006 with 5.7 per cent.
"The election is between potential democracy and potential facism," he told AFP.
Anna Berglund, a 28-year-old lawyer who voted for the small Centre Party at a polling station in Stockholm's upmarket Ostermalm neighbourhood, agreed. "I'm afraid we're becoming a society that is more hostile to foreigners."
The composition of the next government may not be known for weeks. Lengthy negotiations will be needed to build a majority, or at least a minority that won't be toppled by the opposite side.
Speaking to supporters late Sunday Kristersson called on Lofven "to resign", saying he planned to build a government that would "unite our country and take responsibility".
But in order to secure a centre-right majority in parliament, Kristersson would have to put an end to the Sweden Democrats' pariah status and open negotiations with them.
That could prove fatal for the Alliance, with the Liberal and Centre parties repeatedly ruling out a deal with the far-right.
Akesson has said he would demand a curbing of immigration policy in exchange for his support, or key positions on parliamentary committees that draft legislation.
The problems in society that we warned of have grown bigger and worse and people agree with our view of reality," Sweden Democrats parliamentary group leader Mattias Karlsson told public broadcaster SVT.
"When the same party time and again increases, and the other parties stand still, then you have to listen to that part of the population that is voting for this party. It's time to take responsibility and talk to the Sweden Democrats," he said.
(This story has not been edited by Business Standard staff and is auto-generated from a syndicated feed.)