Swedish lawmakers have voted to re-elect the leader of the Social Democrats as the country's prime minister who will lead a minority government along with the Green Party, ending months of political deadlock, authorities said Friday.

Stefan Löfven was able to form a minority government with 115 votes in his favor, 153 against and 77 abstentions.

"On Friday, January 18, the Riksdag (Swedish parliament) voted for President Andreas Norlén's proposal to appoint Stefan Löfven as prime minister," the parliament said in a statement on its website.

"The President welcomes the conclusion of the long process of government formation and will initiate an analysis of the 2018 political autumn," the statement added.

Swedish law stipulates that in order to govern a candidate cannot receive more than 175 votes against them, which would be a majority in the chamber.

This was the third vote to name a prime minister following a general election in September that led to a parliamentary deadlock.

In the September elections, the Social Democrats were the most-voted party with 144 seats, while the opposition Alliance - a coalition of four center-right parties - obtained 143, and the far-right Sweden Democrats, with whom no party wants to negotiate, took 62.