His candidacy was supported by 116 lawmakers, 173 opposed. According to Swedish law, a prime minister is elected unless a majority of the members of parliament (175) vote against his candidacy.
Lofven said on Monday he agreed to present his candidacy for the office, after another nominee refused the offer over a lack of support.
Lofven, the leader of the Social Democratic Party, had served as Swedish prime minister since 2014. On 21 June, the Swedish parliament voted to unseat him in a historic vote of no confidence in a dispute with the Left Party over rent control on housing. A week later, Lofven announced his resignation.