The visitors almost took the lead on 18 minutes when Sadio Mane’s toe-poke came back off the post and John Stones struck his attempted clearance against Ederson before stretching to hook the looping ricochet off the goal-line.
But it was City who took the lead five minutes before half-time. Sergio Aguero stole ahead of Dejan Lovren to beat Alisson at his near post for his seventh goal in as many home matches against Liverpool.
On 64 minutes Liverpool were level, when Trent Alexander-Arnold’s diagonal ball was cushioned back across goal by Andy Robertson and Roberto Firmino headed in from close range.
Sane restored City’s advantage in the 72nd minute, firing in via the far post after racing on to Raheem Sterling through-ball.
Victory means the defending champions are now in second place, four points behind Liverpool, who are top with 54.