Miroslav Klose struck twice in the opening 15 minutes before defender Per Mertesacker made it 3-0 in a game watched by German Chancellor Angela Merkel and Sweden's Prime Minister Fredrik Reinfeldt.
Klose's goals were his 66th and 67th in international football, taking him within one strike of the country's all-time leading scorer Gerd Muller.
Midfielder Mesut Ozil added a fourth goal 11 minutes after the break, chesting down a Thomas Muller cross before firing a wicked shot past goalkeeper Andreas Isaksson.
Sweden captain Zlatan Ibrahimovic launched the fightback with a brilliant header from a long pass by Kim Kallstrom in the 62nd minute.
Mikael Lustig pulled another goal back before Johan Elmander cut Germany's lead to 4-3 in the 76th minute, hitting in a shot between defender Holger Badstuber's legs.
Rasmus Elm then grabbed the equaliser just before the final whistle.
Group leaders Germany have 10 points from four games while Sweden are second with seven points from three.
"I feel a lot of pride for what the players have done here," Sweden coach Erik Hamren told the Kanal 5 television channel.
"Did we believe we could get a result at 3-0 down at halftime? No, no, there was no one who thought that."
Ibrahimovic said Germany started retreating after his 62nd minute goal.
"We played a different way in the second half," said the striker.
"We were too scared and had too much respect in the first half. After my first goal I felt they were backing off more and more."
Germany were dejected at the end of a game watched by a sellout crowd of 72,369 on a damp and chilly evening.
"If you lead 4-0 and it ends 4-4 then something has definitely gone wrong," said captain Phillip Lahm.
"After Sweden's first two goals everything collapsed. That should not happen to a top team.
"We seemed to think we were done after leading 4-0. But we made too many mistakes and did not concentrate," added defender Lahm.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.