Swedish prime minister Stefan Lofven won support from politicians to form a new government after leading the country in a caretaking capacity since late last month.
Mr Lofven received 117 votes in the 349-seat Riksdagen in favour of giving him the mandate, with 58 abstentions.
In Sweden, prime ministers can govern as long as there is no parliamentary majority against them.
Politicians from the Centre Party and the Left Party abstained from voting, paving the way for his victory, while Mr Lofven’s Social Democratic Party, the Greens and one independent politician voted for him.
All together, they accounted for 175 seats in parliament, the minimum number needed for a majority.
The Social Democrats hold 100 seats.
Mr Lofven has said he will form a two-party Cabinet with the Greens.
The 63-year-old Mr Lofven lost a June 21 no-confidence vote called by the right-wing populist Sweden Democrats party.
The move succeeded because the Left Party, a government ally, had withdrawn its support for Mr Lofven’s previous coalition government with the Greens over proposed legislation to tackle a housing shortage.
Instead of calling an early election, as the Swedish Constitution allowed him to, Mr Lofven opted for the coalition-building process that is overseen by Parliament Speaker Andreas Norlen.
The first to be tasked by Mr Norlen to try forming a new government was the head of Sweden’s centre-right opposition Moderates party, Ulf Kristersson.
However, he failed and said he was only able to get 174 politicians behind him.
Mr Lofven, who has served as Sweden’s head of government since 2014, will remain caretaker prime minister until a new government is established.
Sweden’s next general election is scheduled for September 11 2022.