Manchester City survived a sloppy start to secure top spot in Champions League Group F by coming from behind to beat Hoffenheim 2-1 thanks to Leroy Sane's double on Wednesday.
Andrej Kramaric's penalty put the Germans deservedly in front in the 16th minute as another much-changed City side struggled to get up to speed.
However, Pep Guardiola's men found their feet as the first half wore on and were level just before the break courtesy of a brilliant Sane free-kick.
Guardiola was frustrated by his side's wastefulness in front of goal in the second period, but Sane did at least secure victory by converting Raheem Sterling's pass on the hour mark.
City made life difficult for themselves with a flat performance in losing at home to Lyon in their opening group game and were similarly caught cold having already secured their place in the last 16.
Kramaric had fired a warning shot inches over before Ederson in the City goal showed he wasn't to be outdone by Brazilian international teammate Alisson Becker's heroics to secure Liverpool's place in the knockout stages against Napoli on Tuesday by producing an incredible finger-tip stop to turn another curling effort from the Croatian behind.
However, Kramaric's luck was in third time round from the penalty spot after Aymeric Laporte was punished for hauling down Benjamin Hubner.
All of City's best efforts before the break came from set-pieces as Gabriel Jesus headed Sane's corner off the post before Oliver Baumann got down well to deny John Stones.
Andrej Kramarić put Hoffenheim ahead in the first half through a penalty
Nicolas Otamendi sent another wicked dead ball delivery from Ilkay Gundogan off the crossbar, but the hosts were finally level in spectacular fashion when Sane curled home a free-kick into the top corner from 30 yards out.
Hoffenheim needed to win just to have a chance of qualifying for the Europa League knockout stages in third, but in their desperation to chase a winner left themselves hopelessly exposed to the pace of Sane and Sterling after the break.
Sane was guilty of overplaying as City incredibly spurned a three-against-one when Sterling fed the German, who tried to tee up the surprised Bernardo Silva rather than going for goal himself and Baumann saved the Portuguese's shot.
Sterling has been in the news for bravely speaking out about the alleged racist abuse he suffered in defeat at Chelsea on Saturday and news coverage he has received in the past.
However, the England international showed little sign of letting it disrupt his fine form on the pitch as he teed up Sane to round Baumann and slot home the winner.
Pep Guardiola handed Phil Foden his first Champions League start of the season and the 18-year-old was only denied a spectacular first goal in the competition by a fine save by Baumann to turn his dipping volley over.
However, it mattered little as the competition favourites march into Monday's last 16 draw where they can face Atletico Madrid, Schalke, Ajax or Roma.