Sweden's election was too close to call on Sunday night, Prime Minister Magdalena Andersson said.
Exit polls at first predicted victory for the incumbent left-wing coalition, but results later suggested the right-wing bloc could narrowly win.
Crime and integration of communities were major issues in the campaign, and the far-right Sweden Democrats look set to become the second-largest party.
It could take until Wednesday for all votes to be counted.
Soon after polls closed, an early exit poll by Sweden's public broadcaster suggested Ms Andersson's coalition of four left-wing parties would narrowly win, with 49.8% of the vote compared to 49.2%.
But the left's celebrations were perhaps premature, as later partial results put the right-wing group ahead, with a projected 176 of 349 seats in parliament after 94% of electoral districts were counted.
As the race is so close, the final result may have to wait until all votes, including postal and advance votes, are counted over the next few days.
Whatever the result, the far-right Sweden Democrats have made significant gains, appearing to become the country's second-largest party behind the Social Democrats.
However, its leader, Jimmie Akesson, is unlikely to become prime minister even if the right-wing bloc wins the largest number of seats. Instead, Moderate Party leader Ulf Kristersson is likely to take that role, with the Sweden Democrats hoping to become part of his government.
Swedes are used to complex coalition politics but even here this election race has been viewed as nail-biting and at times confusing by voters from across the spectrum.
There is a lot to digest. Magdalena Andersson's Social Democrat party looks certain to remain the largest. Yet this election could be a victory for the right. The anti-immigration Sweden Democrats are on course to come in second place. But it's the leader of the third largest party, the Moderates, who would become prime minister in a future right-wing government, since he's seen as the most palatable option within the bloc of right parties hoping they've edged a majority. And there's still a chance things could change, as more votes are counted.
A right-wing government would represent a major departure for Sweden after eight years of Social Democrat-led governments. At a coffee shop in central Stockholm this morning, I overheard two voters worried about a deepening anti-immigrant rhetoric. But a cab driver from Argentina I chatted to told me he's not worried about life changing dramatically, arguing that the deadlock between the right and left blocs could still make it hard for whichever side gets in to push through major policy changes.
Born out of a neo-Nazi movement at the end of the 1980s, the anti-immigration Sweden Democrats entered parliament with 5.7% of the vote in 2010, increasing this to 17.5% in 2018. It looks set to win more than 20% this time.
Moderate Party leader Ulf Kristersson orchestrated a major shift in Swedish politics in 2019 by starting talks with the Sweden Democrats, who had long been treated as pariahs by other political parties.
Magdalena Andersson's Social Democrats have governed Sweden since 2014 and dominated the country's political landscape since the 1930s.
Voter turnout in this election was expected to be high, with more than 80% of the country's 7.8 million eligible voters expected to cast ballots.
The election campaign has been dominated by rising gang shootings, immigration and integration issues, and soaring electricity prices.
While the violence was once contained to certain locations, it has spread to public spaces such as parks and shopping centres, sparking concern among ordinary Swedes in a country long known as safe and peaceful.