MANCHESTER, England — Leroy Sane scored two goals, including a free kick from 30 metres, as Manchester City came from behind to beat Hoffenheim 2-1 and secure first place in its Champions League group on Wednesday.

City recovered from losing its opening game in Group F — 2-1 at home to Lyon — to finish top by five points, and advance to the round of 16 for the sixth straight year as it bids to become European champion for the first time.

Despite being assured of a top-two finish, City manager Pep Guardiola fielded a strong team in a bid to clinch first place, but saw his side fall behind to Andrej Kramaric's 16th-minute penalty.

City struck the goal frame twice before equalizing when Sane stepped up to send a powerful, dipping free kick past goalkeeper Oliver Baumann in the first minute of stoppage time.

The Germany winger then grabbed the winner in the 61st by exchanging passes with Raheem Sterling, taking a touch beyond Baumann, and slotting the ball into an empty net.

That made up for an embarrassing missed opportunity moments earlier, when Sterling and Sane led a three-man counterattack beyond Hoffenheim's defence. With only Baumann to beat, Sterling squared the ball to Sane, who opted to pass inside to Bernardo Silva instead of shooting and the chance was squandered.

Hoffenheim finished bottom of the group, despite scoring 11 goals, to also miss out on dropping into the Europa League. It turned out to be the last European game as Hoffenheim coach for Julian Nagelsmann, who will leave for Leipzig at the end of the season.

City will be seeded in Monday's draw for the last 16, meaning a home match in the second leg against a second-placed finisher.

___

More AP soccer: https://apnews.com/apf-Soccer and https://twitter.com/AP_Sports