André Schürrle scored a hat-trick as Germany recovered from a two-goal deficit to finish their World Cup qualifying campaign with a 5-3 win over Sweden.

Germany had already secured first place in Group C and a spot at the World Cup, while Sweden had clinched a play-off berth by beating Austria in the previous round.

Mesut Özil and Mario Götze also scored for Germany while Sweden's Tobias Hysen scored two and Alexander Kacaniklic netted one.

Both teams put on a display of clinical finishing but sloppy defending in Stockholm, with Germany controlling possession but looking vulnerable at the back.

Also in Group C, the Republic of Ireland rallied to beat Kazakhstan 3-1 and Austria defeated the Faroe Islands 3-0.

Germany finished with 28 points and could have had a perfect record had they not squandered a four-goal lead to draw 4-4 with Sweden last year in Berlin.

Sweden took second place with 20 points, three more than Austria, while Ireland finished fourth with 14.

Hysen gave Sweden the lead in the sixth minute after Germany defender Jérôme 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 Müller's header on to the crossbar. Instead the German defence was caught napping again as Kim Kallstrom fed the ball to Alexander Kacaniklic, who made it 2-0 in the 42nd.

Özil 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 the Sweden goalkeeper Johan Wiland's right-post.

Sweden, without the suspended striker Zlatan Ibrahimovic, had very little possession and were lucky to be ahead at half-time.

The second-half substitute Götze equalized shortly after the break with an elegant shot and Schürrle silenced the home crowd with two goals preceded by sloppy mistakes in the Swedish defence. But Hysen revived Sweden's hopes when he made it 4-3 by volleying home following a free-kick from Larsson.

It took another goal from Schürrle to seal the win for Germany as he completed his hat-trick in the 77th minute with a curled shot from the left edge of the penalty area.