Andre Schuerrle scored a hat trick Tuesday as Germany recovered from a two-goal deficit to finish its World Cup qualifying campaign with a 5-3 win over Sweden.
Germany had already secured first place in Group C and a spot in the World Cup. Sweden had clinched a playoff berth by beating Austria in the previous round.
Mesut Ozil and Mario Goetze also scored for Germany while Sweden's Tobias Hysen had two goals and Alexander Kacaniklic netted one.
Both teams put on a display of clinical finishing but sloppy defending in Solna, with Germany controlling possession but looking vulnerable at the back.
"Five-three is an odd result but the important thing is that we won," said midfielder Bastian Schweinsteiger, who played his 100th match for Germany. "It's clear that we need to improve defensively but by the World Cup we will stand strong."
Also in Group C, Ireland rallied to beat Kazakhstan 3-1 and Austria defeated the Faeroe Islands 3-0.
Germany finished with 28 points and could have had a perfect record had it not squandered a four-goal lead to draw Sweden 4-4 last year in Berlin.
Sweden took second place with 20 points, three more than Austria, while Ireland was fourth with 14. Kazakhstan had five points and the Faeroe Islands finished last with a single point.
Germany coach Joachim Loew said the qualifying campaign had exposed some cracks in the defence despite the near-perfect record.
"In some matches that part hasn't been perfect," he said. "But overall we're satisfied."
Hysen gave Sweden the lead in the sixth minute after Germany defender Jerome Boateng allowed the striker to slip into the penalty area unchallenged and meet a long pass from Sebastian Larsson.
Germany took full control after the early setback but struggled to create chances beyond Thomas Mueller's header into the crossbar. Instead the German defence was caught napping again as Kim Kallstrom fed the ball to Kacaniklic, who made it 2-0 in the 42nd.
Back in the game
Oezil put the visitors back in the game just before the break as he caught a deflected pass from Max Kruse and struck a right-foot shot just inside Sweden goalkeeper Johan Wiland's right post.
Sweden, without suspended striker Zlatan Ibrahimovic, had very little possession and was lucky to be ahead at half time.
Second-half substitute Mario Goetze equalized shortly after the break with an elegant shot and Schuerrle silenced the home crowd with two goals preceded by mistakes in the Swedish defence. But Hysen revived Sweden's hopes when he made it 4-3 with a volley on a free-kick from Larsson.
It took another goal from Schuerrle to seal the win for Germany as he completed his hat-trick in the 77th with a beautifully curled shot from the left edge of the penalty area.
"We just have to admit we lost to a better team," Sweden coach Erik Hamren said.
In Dublin, Dmitri Shomko put Kazakhstan ahead before Ireland rallied with first-half goals from Robbie Keane and John O'Shea and an own goal by Andrey Finonchenko in the second.
Austria finished its qualifying campaign with goals from Andreas Ivanschitz, Sebastian Proedl and penalty kick from David Alaba.