Image source, ReutersImage caption, Magdalena Andersson entered politics in the 1990s

Magdalena Andersson has been approved by Sweden's parliament as the country's first ever female prime minister, replacing Stefan Lofven as leader of the centre-left Social Democrats.

Sweden is the only Nordic country never to have elected a woman as national leader before.

Ms Andersson, who's currently finance minister, lost Wednesday's vote.

However, she was elected because under Swedish law she only needed a majority of MPs not to vote against her.

The 54-year-old Social Democrat leader was given a standing ovation by sections of the parliament, or Riksdag, Swedish television reports.

Her election followed an 11th-hour deal with the opposition Left party, in exchange for higher pensions for many Swedes.

Of the 349 members of the Riksdag, 174 voted against her. But on top of the 117 MPs who backed Ms Andersson, a further 57 abstained.

A former junior swimming champion from the university city of Uppsala, she began her political career in 1996 as political adviser to Prime Minister Goran Persson.

However, she faces a tough job from the outset, with opposition parties on the right saying they'll reject the government's budget later on Wednesday.