Liberal Prime Minister Lars Lokke Rasmussen, whose party has been in power for 14 of the past 18 years, conceded defeat after the Social Democrats emerged as the biggest party with 25.9 percent of votes, giving the left-wing bloc a majority of 91 of the 179 seats in parliament, with 100 percent of votes counted.
Rasmussen's Liberal Party won 23.4 percent of the votes, up almost four points since the 2015 election, but the rightwing bloc only took 75 seats.
“We had a really good election, but there will be a change of government,” Rasmussen (pictured below) told supporters late Wednesday.
Photo: Mads Claus Rasmussen/ Ritzau Scanpix
The leader of the Social Democrats and the likely next prime minister, 41-year-old Mette Frederiksen, said Danes had “chosen a new majority, and a new direction”.
Rasmussen's government was brought down by a collapse for the anti-immigrant Danish People's Party, which has informally supported his minority coalition to pass legislation.
The Danish People's Party, which has supported successive minority rightwing governments in exchange for tighter immigration policies for the last two decades, saw its support more than halved to 8.7 percent, the party's worst score since 1998.
Party head Kristian Thulesen Dahl (pictured below) told supporters at an election night rally that the party hadn't been “good enough” and he shouldered the blame, but also said he wanted to continue as leader.
(Photo: Philip Divali/ Scanpix Ritzau)
“I'm not abandoning ship in the middle of the storm, I take the responsibility to once again move the party forward,” he said.
As restrictive immigration policies have been broadly adopted by almost all other parties, the Danish People's Party has lost its unique appeal with voters.
U-turn on immigration
The Social Democrats, last in power between 2011 and 2015, were widely seen as favourites going into the vote.
Led by Frederiksen — a party veteran who made her debut in parliament at 24 — the Social Democrats have also changed their tone on immigration.
In the early 2000s, she denounced Denmark's policy as one of the “toughest in Europe”.
The numbers below from Danish broadcaster DR show the final results and the number of seats each party gained. Social Democrats are on the left, followed by the Liberals and then the far-right Danish People's Party.
But under her leadership, the Social Democrats last year proposed, as part of their crackdown on immigration, to send asylum seekers to special camps in North Africa while their requests are processed.
With most parties in agreement on a tough immigration policy, and as Denmark enjoys robust growth, almost full employment and strong public finances, the Social Democrats focused their election campaign on climate issues and the defence of the welfare state, promising to reverse budget cuts
to education and healthcare.
Tough talks ahead
Frederiksen now faces lengthy negotiations in the weeks to come to secure support for her new government.
In her victory speech, she said she intended to build a single-party government — and left-wing parties were swift to state their demands in exchange for their support.
“We want an ambitious climate policy,” the head of the main green party, the Socialist People's Party, Pia Olsen Dyhr, said.
Her party was one of the election's big winners on Wednesday, clinching 7.7 percent of votes, up from 4.2 percent in 2015.
The left-wing parties “are going to put pressure on Mette Frederiksen on all fronts,” conservative daily Jyllands-Posten wrote in an editorial.
According to a Gallup poll published in February, some 57 percent of Danes think the next government should prioritise climate change.
For those aged between 18 and 35, the figure was 69 percent.
The Social Democrats are expected to cooperate with the right on immigration issues and with the left on other matters.
But the Social Democrats could find it necessary to forge more lasting ties to find political stability, given the country's fragmented political landscape.
The Danish People's Party's slide meanwhile coincided with the emergence of two more extreme far right parties, New Right and the anti-Muslim Hard Line.
The former won 2.3 percent of votes and will enter parliament, while the latter failed to win the two-percent minimum for representation in parliament.
The Danish parliament, the Folketing, has 179 seats, four of which represent the autonomous territories of Greenland and the Faroe Islands, which have two seats each.
Voter turnout, which is typically high, came in at 84.5 percent, just below the 85.9 percent from 2015.