Many online surveys, which in the last election had gauged the Sweden Democrats' vote better than conventional polls, had signalled they could dethrone the Social Democrats as the nation's biggest party - a position the centre-left has held for a century
Sweden faces a political impasse after its mainstream centre-left and centre-right blocs virtually tied in an election on Sunday, while the far-right - which neither wants to deal with - made gains on a hardline anti-immigration platform.
With nearly all votes counted on Monday, the ruling centre-left Social Democrats and Greens and their Left Party parliamentary ally had 40.6% of the vote, while the opposition centre-right Alliance was on 40.3%.
That translates into a single-seat advantage in the 349-member Riksdag.
The Sweden Democrats, a party with white supremacist roots, won 17.6%, about 5% points more than four years ago. It was the biggest gain of any party and in line with conventional opinion polls but fell short of the 20%-30% their leader Jimmie Akesson had predicted.
"Most signs pointed towards the Sweden Democrats taking over the position as the second-biggest party in Sweden. But the expected ... bang did not happen," the liberal Expressen daily said in an opinion piece. "Sweden is now on steadier grounds than what we could have feared before the election."
Many online surveys, which in the last election had gauged the Sweden Democrats' vote better than conventional polls, had signalled they could dethrone the Social Democrats as the nation's biggest party - a position the centre-left has held for a century.
In the end, the Sweden Democrats were beaten by Prime Minister Stefan Lofven's Social Democrats by a 10% point margin and eclipsed also by Ulf Kristersson's Moderates, the Alliance's candidate for the premiership.
Sense of relief
The Sweden Democrats' success follows a rise in popularity of other far-right parties in Europe amid growing anxiety over national identity, the effects of globalization and fears over immigration boosted by conflicts in the Middle East and Africa.
Sweden saw itself as a "humanitarian superpower" for years, but a rise in gang violence in immigrant-dominated, socially deprived city suburbs has also won support for the Sweden Democrats.
After the arrival of 163,000 asylum seekers in 2015 - the most in Europe in relation to the country's population of 10 million, the government suspended many of its liberal asylum policies.
There was a sense of relief among supporters of mainstream parties about the far-right's less dramatic gains. That was shared in Brussels. "It is clear that the claim that the far-right is on an inexorable roll and will devour everything that stands in its way is false," said one EU official, while acknowledging that there is fragmentation among parties.
Still, the Swedish election underscored a broader shift to the right in one of Europe's most socially progressive nations.