The former welder got 132 yes votes. 49 people voted against him and 154 abstained.
Fourteen of Parliament's 349 MPs were not present for the vote.
The abstentions came from the Alliance parties that made up the previous centre-right government, the Moderates, the Christian Democrats, the Liberals and the Centre party.
"Wow, how truly great and momentous this is," Stefan Löfven told reporters after his appointment was agreed on.
"I accept this role with great respect, of course."
Sweden has a system of negative parliamentarianism, which means that Löfven did not need majority of votes in his favour to get selected, he only needed to make sure a majority did not actively vote against him.
All members of nationalist Sweden Democrat Party chose not to vote for the Social Democrat leader.
The far-right group's head Jimmie Åkesson said: "We can not see the election results offered a clear mandate for Stefan Löfven to form a government".
Sweden's new Prime Minister with parliament's Speaker. Photo: TT
Stefan Löfven was not an elected member of parliament until the country's national election last month and has no previous experience of being a politician.
A former leader of one of the country’s most powerful unions, IF Metall, he was persuaded to stand for leadership in 2012 following record low poll ratings for the Social Democrats.
The Social Democrats are the oldest and largest party in Sweden and dominated the political landscape until the 1990s. The party promotes workers' rights and built the modern Swedish welfare state, paid for by progressive taxation.
Speaking after Thursday's vote, Stefan Löfven said that his incoming government had "a lot to do".
He argued that the unemployment rate in Sweden must be reduced and that school results should be improved.
"We must ensure that welfare is available for people when they need it," said Löfven.
The new Prime Minister also stressed that he wanted Sweden to be "a strong player in the world".
Stefan Löfven's next key job is to announce his top team of ministers. His team will also be working on their future budget, which must be passed in order for them to remain in government.
The leaders of the centre-right parties that made up the outgoing government Alliance have already said they're prepared to put forward a budget of their own, as have the Sweden Democrats.
But Moderate Party spokesperson Anna Kinberg Batra told reporters that she expected the Left Party to support the Red-Green coalition's budget, which should ensure it gets passed.