What the polls had predicted would be an easy victory for the Social Democrats in Denmark's September 15 election turned out to be much closer.

The last poll before the vote showed the Social Democrat leader Helle Thorning-Schmidt ahead of her Liberal opponent Lars Løkke Rasmussen by 52.3% to 47.5% as preferred prime minister.

However, Danes came out in droves to vote, with total voter turnout at 87.7%, its highest level in decades. The final result saw the left-of-centre parties winning by only 50.3% to 48.9%, 89 seats to 86.

The likely result in the four seats elected in Greenland and the Faroe Islands (three to one to the centre-left) will make their final majority 92 seats to 87 in Denmark's 179-seat parliament.

The Social Democrats have won office -- and installed Denmark's first women prime minister -- not so much because of their own performance. Rather it was because of the collapse of support for the country's most right-wing parties, including the overtly racist Danish People's Party (DPP), and the big increase in support for the Social Liberals and the Red-Green Alliance.

The Social Liberals are the most conservative of the four left of centre parties and the Red-Green Alliance the most radical.

The Social Liberals won 9.5% of the vote, increasing their number of seats by eight to 17. The Red-Green Alliance significantly increased its representation in the parliament from four to 12 seats, winning 6.7% of the vote.

The Social Democrats actually recorded their worst result since 1906, and remain only the second-largest party in parliament. They are behind the Liberals, who, despite economic stagnation and participation in the wars in Afghanistan and Libya, increased their support by one seat.

That strong result had Rasmussen cautioning Thorning-Schmidt not to get too comfortable in her position. “Take care of the keys to the Prime Minister’s Office, they are only yours to borrow,” he said during his concession speech.

The result reflects real trends in Danish society.

The Red-Green Alliance increased its support as the most visible and consistent force in Denmark opposing neoliberal economic policies, Danish participation in NATO and racist immigration laws. It won votes away from the Socialist People's Party (SPP), which originated as an anti-Stalinist split from the Communist Party in the 1960s.

The SPP also appears to have lost votes to the Social Democrats, who campaigned strongly on the traditional SPP themes of defence and extension of the Danish welfare state.

In her acceptance speech, Thorning-Schmidt pledged to work for a society that “included everyone, and where everyone got a second chance – and another second chance”. The Social Democrats promised an increase in taxes on the wealthy to fund a reinvigorated welfare system.

Thorning-Schmidt also pledged to seek broad-based compromise and called on “everyone”, politicians and ordinary voters alike, to take part in that effort.

The gain for the Social Liberals reflected a switch from middle-class sectors from supporting both the right parties and the Social Democrats.

Within the right, the vote that deserted the Conservatives and DPP went to strengthen the Liberals, seen as the strongest bastion against the what is known in Denmark as the "red bloc".

Debate over how to revive Denmark's flagging economy is sure to dominate debate in the new parliament, especially as the country's most ideological neoliberals, the Liberal Alliance, nearly doubled their representation to nine seats.

Thorning-Schmidt will negotiate to draw the Social Liberals and SPP into government, but she is unlikely to invite the Red-Green Alliance, which has vowed to push the new government as far to the left as possible, while supporting it against censure motions from the right opposition.

The most immediate positive benefit of the result will be the end of Denmark's frontier controls, imposed by the former government as the price of DPP support on other issues in parliament.

Danish 2011 parliamentary election results