MPs backed Social Democratic Party leader Magdalena Andersson by a narrow margin in a new vote on Monday.
She will attempt to lead a one-party government until an election in September next year.
She stood down as PM last Wednesday after her coalition collapsed.
Just hours earlier, Ms Andersson had been elected as Sweden's first female prime minister by a single vote in parliament.
But the 54-year-old economist's plan for forming a new coalition government with the Green Party was thrown into disarray when her budget proposal failed to pass.