A stoppage-time goal from Toni Kroos gave holders Germany a dramatic 2-1 win over Sweden on Saturday to reignite their hopes of qualifying for the World Cup last 16.

Having lost their opening game to Mexico, the Germans looked to be heading for a draw until Kroos curled in a superb strike from wide on the left to secure victory for the four-times world champions.

They are now level with Sweden in Group F on three points, behind leaders Mexico who have six.

Sweden took the lead in the 32nd minute when Ola Toivonen finished confidently after Kroos gave the ball away in midfield, chesting the ball down expertly before lifting it over Manuel Neuer.

Marco Reus equalised in the 48th minute and despite having Jerome Boateng sent off in the 82nd minute, Germany kept going and Kroos's shot five minutes into stoppage time earned them a famous win.

Relief for Germany, cruel blow for Sweden

Toni Kroos and Joachim Low
Toni Kroos celebrates with Joachim Low after the winning goal in Sochi.ODD ANDERSEN/AFP/Getty Images

"I told them to keep their calm in the next 45 minutes (second half) and to not start panicking and try to work long, high balls but to continue with short passes and go vertical to the wings and try to be incisive," Germany coach Joachim Loew told reporters.

"Something that I did appreciate was that we didn't lose our nerve, we didn't panic after going down. And in the second half the pressure built up more and more," he added.

"We did not take our chances. We should have taken the lead in the opening minutes and we failed to do that (but) there is joy now," Kroos told reporters.

"I know a lot of people would have been happy for us to be eliminated but we will not make it that easy for them ... now we must recover, we don't have too much time, and we must beat South Korea."

Toni Kroos
Toni Kroos scored an injury-time winner in Sochi on Saturday.Michael Steele/Getty Images

It was a cruel blow for the Swedes, who gave their all but came up just short.

"It's probably the worst end of a game I've experienced in my career, that we didn't get a draw, but the whole group is still alive, so we'll have to lick our wounds and come back for the next one," Sweden coach Janne Andersson said

Defending deep and looking to counter, the Swedes started shakily but took the lead when they punished Kroos for giving the ball away by quickly finding Toivonen, who lifted the ball deftly over Neuer.

With Germany getting in behind Sweden's full backs at will and fizzing passes across the box, it looked like a matter of time before they scored, but Toivonen's goal gave Sweden breathing space.

Neuer saved the Germans from being 2-0 down at halftime, diving acrobatically to deflect Berg's header from Sebastian Larsson's stoppage-time free kick.

Reus connected with his knee to steer the ball home for the equaliser early in the second half to mark the beginning of a massive German offensive.

Boateng's sending-off and late drama in Sochi

Substitute Mario Gomes gave the Germans a physical presence they had lacked, but he spurned two superb chances.

Boateng's sending-off for his second yellow card eight minutes from time made little difference as the Germans continued to push forward in search of the winner.

Sweden had tired from their enormous defensive effort, but substitute John Guidetti should have done better than a lame shot, oblivious to the unmarked Emil Forsberg who was steaming through the middle.

From there the Germans launched the attack that led to substitute Jimmy Durmaz tripping Timo Werner and conceding the free kick that set up the chance for Kroos to curl in the winner.

The ball arced over helpless keeper Robin Olsen into the net, sparking an explosion of German joy on the bench and in the stands as the reigning champions kick-started their World Cup campaign.