The close general election gave victory to the social democrats, closing a decade of rightwing ascendancy during which a minority government of liberals and conservatives was kept in power by parliamentary support from the europhobic, Muslim-baiting Danish People's party.
Helle Thorning-Schmidt, the social democrat leader and daughter-in-law of Neil and Glenys Kinnock, salvaged her political career by ousting the liberal prime minister Lars Lokke Rasmussen's coalition at her second attempt. She is expected to form a government with three other liberal and leftwing parties.
Her victory, though, was narrower than predicted and could produce a fragile coalition. Her "red bloc" secured only a three-seat majority of the 175 at stake in mainland Denmark, with almost all votes counted. A further four seats reserved for faraway Greenland and the Faroes islands had still to be declared. The expectation was that the centre-left would emerge with a five-seat margin in the 179-seat chamber in Copenhagen.
The social democratic win bucked the trend of politics in Europe where the centre-left has been in the doldrums, unable to capitalise on the fallout from the 2008 financial and economic crisis and stagnation in the EU while also failing to come up with attractive policies on other potent issues such as immigration and Islam.
European centre-left leaders claimed to detect a shift in the public mood ahead of elections in France and Italy next year.
The DPP, whose influence has forced the passage of dozens of laws countering immigration and whose success over the past decade has made it the model for likeminded parties in Sweden, Finland and The Netherlands who have chalked up notable gains over the past two years, conceded defeat and promised robust opposition.
"Immigration policy is our lifeblood. Do you think they can get by without us? No, they can't," declared Pia Kjaersgaard, the party leader.
The far right has succeeded in making its tough anti-immigrant position the Danish mainstream stance. Thorning-Schmidt is not expected to veer radically from that, but two of her proposed coalition partners, the Social Liberal party and the Red-Green Alliance, performed strongly in the election and espouse less restrictive immigration policies.
Analysts said that in a society that prizes consensus, major changes in key policy areas were unlikely. But with economic stagnation and a rising budget deficit dominating the campaign, the outgoing government promised spending cuts while Thorning-Schmidt argued for more investment in education, welfare, and infrastructure.
Given the austerity policies favoured across Europe by the dominant centre-right as the response to the lack of growth, Denmark will be watched to see whether the new government will take a different approach and succeed.