The French will play holders Spain in the last eight in Donetsk on Saturday with group winners England, who beat co-hosts Ukraine 1-0, facing Italy in Kiev on Sunday.
Ibrahimovic's acrobatic volley from just inside the area, the striker swivelling to meet Larsson's cross, put already-eliminated Sweden ahead on 54 minutes in what will be a strong contender for goal of the tournament.
It was Sweden's first victory over the French since 1969 and France's first defeat in 24 games.
"Sweden beat an average France team," France coach Laurent Blanc told French television. "They were better in all departments."
Already eliminated, the Swedes had clearly decided they were not going down without a fight and they flew into challenges from the first whistle.
With the French through as long as Ukraine did not win, there was always the chance of a dull game but both sides played with commitment, pace and skill.
Sweden forward Ola Toivonen had a great chance to open the scoring when Philippe Mexes botched a defensive header and let him run free in the French half.
Lloris came out quickly to force him wide and the Swedish striker's effort grazed the outside of the post with the goal at his mercy.
France looked slick in possession and alarm bells rang every time Franck Ribery ran at the Swedish defence. Several times he ghosted down the left wing to create openings that were wasted by his team mates.
Ribery, Hatem Ben Arfa, Karim Benzema and Samir Nasri all threatened with shots from distance but none troubled Andreas Isaksson unduly.
Christian Wilhelmsson replaced Emir Bajrami at the break and immediately set about making a nuisance of himself for the French defence.
Ibrahimovic brought the crowd to their feet in the 54th minute, finishing Larsson's cross with a breathtaking scissor-kick.
Yann Mvila did his best to get the French back on level terms with two fine efforts from outside the box, the first saved by Isaksson and the second clearing the crossbar.
Substitute Jeremy Menez could have equalised for France but his shot hit Isaksson's legs.
Sweden held on for victory but France will have a chance to regroup before facing the world champion Spaniards.
Mexes will miss that clash after picking up a booking for a foul on Toivonen, his second of the tournament.