Danes handed their current prime minister another mandate at the polls in what was seen as a vote of confidence in Mette Frederiksen's handling of the COVID pandemic and her ability as a leader to overcome yet another crisis.
The Social Democrats secured their strongest backing in more than two decades, despite criticism of Frederiksen's tenure for having centralised power around her office and her controversial decision to cull all mink during the pandemic.
“I am so thrilled and proud. We have gotten the best election result in 20 years,” Frederiksen told supporters early on Wednesday in Copenhagen.
"Thanks to all Danes who have trusted us with your vote. It's a huge vote of confidence. I know some of you have had doubts along the way."
In a nail-biter of an election, two differing vote count projections by the country's largest broadcasters put into question until the last moment whether the ruling left-wing bloc could triumph.
The Social Democrats again became the biggest party in parliament with 27.5% of votes.
The left-leaning bloc got 87 seats in the 179-seat parliament, which would give it a majority with support from a Faroe Island mandate and two yet-to-be-determined seats in Greenland, a sovereign territory of Denmark that often elects left-wing candidates.
A majority of the left-wing parties is likely to present a dilemma for Frederiksen, who has advocated a broad coalition across the traditional left-right divide, arguing that political unity is needed at a time of international uncertainty.
Forming a broad coalition could prove difficult, however, as most of her left-wing allies say they would prefer a pure left-leaning government.
Frederiksen has led the country through one of the most chaotic terms to befall a Danish government in decades, having to handle a pandemic, soaring inflation, and geopolitical uncertainty.
The election came only a month after the sabotage of two pipelines carrying gas from Russia to Germany through Danish waters fuelled an unprecedented sense of insecurity among Danes.
"In Denmark, we have for many years been used to progress. Now we face hardship, and with war in Europe, energy scarcity, inflation and climate challenges, the crises combine," Frederiksen said.
She said she will submit the resignation of her one-party government to the Queen on Wednesday and seek to form a broad government.
She could begin negotiations with former prime minister Lars Lokke Rasmussen and his new non-aligned centrist party, the Moderates, which have also campaigned for a coalition of mainstream parties.
The left-leaning parties that Frederiksen can rely on to form a new government include the Socialist People's Party, the Red-Green Alliance and the Social-Liberal Party -- the latter of which used to be headed by European Union Competition Commissioner Margrethe Vestager.
Opposition leader Jakob Ellemann-Jensen of the Liberal Party acknowledged a defeat early Wednesday. His party lost 19 of its 43 seats in parliament.