The Netherlands had already won Group E after nine straight wins and are also through to Euro 2012. The Swedes advanced as the best runner-up in the nine qualifying groups.
Kim Kallstrom, Sebastian Larsson and Ola Toivonen scored for Sweden while Klaas-Jan Huntelaar and Dirk Kuyt had a goal each for the visitors.
The Netherlands dominated possession but lost the game on two defensive mistakes within minutes after going up 2-1 in the second half.
''We were the better team but they scored the goals in a few minutes and we made too many mistakes,'' Netherlands coach Bert van Marwijk said. ''We are concentrated for 88 minutes but the (other) two minutes cost us this game and that's a lesson for us.''
The Dutch, who were without injured playmakers Arjen Robben and Wesley Sneijder, took control of the game from the start but it was the home side that scored first, when a foul on Johan Elmander set up a Swedish freekick in the 14th minute, five meters from the penalty box.
Kallstrom took three short steps and curled the ball over the wall and into goalkeeper Michel Vorm's left corner.
The goal energized the Swedish team and the sellout crowd at Rasunda stadium for about 10 minutes before Huntelaar equalized in the 23rd, breaking away from the Swedish defense to head in a cross from Erik Pieters.
Ola Toivonen - replacing suspended captain Zlatan Ibrahimovic - squandered a chance to put Sweden back in the lead when he shot high over the bar from close range in the 31st. Robin van Persie shot wide from the right flank as the Dutch gradually regained control of the match but struggled to create scoring chances.
Kuyt put the Netherlands in the lead just four minutes after the break, heading in a rebound from Sweden goalkeeper Andreas Isaksson.
But the Dutch invited Sweden back into the match just a minute later as Joris Mathijsen handled the ball inside the area, and Sebastian Larsson calmly converted from the penalty spot.
Swedish fans were still celebrating when Toivonen scored the winner from a powerful shot in the 53rd after the Dutch defense failed to clear a low cross from Elmander.
Isaksson made a spectacular foot save on Huntelaar's header in the 64th and the Dutch never came close after that despite a barrage of corner kicks.
Sweden had not won a competitive match against the Netherlands since 1924.
''This was a fantastic team effort,'' Sweden coach Erik Hamren said. ''I would like to see that we have the ball as much as Holland but we're not that good yet.''
Van Marwijk said the Netherlands were so superior they would have won the match eight times out of 10 if it had been replayed.
''I'm sticking with the game we played tonight,'' Hamren said.
Sweden : Andreas Isaksson, Mikael Lustig, Olof Mellberg, Daniel Majstorovic, Martin Olsson, Anders Svensson, Kim Kallstrom, Rasmus Elm, Ola Toivonen (Pontus Wernbloom, 75) Sebastian Larsson, Johan Elmander.
Netherlands : Michel Vorm, Gregory van der Wiel, Jeffrey Bruma, Joris Mathijsen, Erik Pieters, Robin van Persie, Kevin Strootman (Luuk de Jong, 81), Klaas-Jan Huntelaar, Rafael van der Vaart, Dirk Kuyt (Eljero Elia, 73).