Earlier in the day, Lofven presented his third government in parliament since the Social Democrat leader first came to power in 2014.
The parliamentary vote was held on Wednesday.
On 21 June, the Swedish parliament voted to unseat Lofven 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.
Andreas Norlen, the parliament's speaker, entrusted Ulf Kristersson, the leader of the liberal-conservative Moderate Party, to form a new government. However, Norlen returned to Lofven after Kristersson failed to gain enough support.