Paris Saint-Germain also qualified for the round of 16 after Rasenbal Sport Leipzig beat Club Brugge.
Kylian Mbappe put the Paris team ahead in the 50th minute, scoring the net after Lionel Messi’s cross pass collided with defender Kyle Walker and turned its way towards the French striker.
City equalized when Raheem Sterling touched the ball and netted it at the far post after a beautiful pass from Rodri to Walker, who sent his distinctive low cross.
Riyad Mahrez made the winning goal, passing the ball over the defense to Bernardo Silva at the far post and the Portuguese midfielder touched the ball gracefully to Jesus to score easily.
One round before the end of the group stage, City leads Group A with 12 points, while Paris Saint-Germain has eight points. Leipzig and Brugge, each with four points, will compete for the qualification to the European League.