N'Golo Kante put the visitors ahead but Kevin De Bruyne equalised with a deflected effort before Riyad Mahrez scored what turned out to be the victor.
On 37 minutes City took the lead for the first time and it was an absolute doozy of a goal.
Liverpool's late win at Crystal Palace earlier in the day meant City started 12 points behind the leaders and looked in danger of failing to cut that gap when N'Golo Kante gave Chelsea a deserved lead midway through the first half.
All of the games have had a similar theme: Chelsea not being clinical enough in the final third and getting punished for sloppy errors at the back.
And Chelsea finally made the pressure tell on 21 minutes as Kante outmuscled Benjamin Mendy to gather Mateo Kovacic's lofted pass, and the Frenchman bundled the ball over the on-rushing Ederson.
This is not a cautious Chelsea side, they are bold and adventurous; they have a bit of style, a bit of a swagger.
Manchester City have conceded the first goal in three of their last four home league games, as many as they had in their previous 51 at the Etihad.
City only had 46.74 possession against the in-form Blues, the lowest recorded by a Guardiola side in his 381 top-flight matches as a manager, but they collected a crucial three points.
And he reckons there is no doubt Chelsea will qualify for the Champions League again this season.
In a game that flowed from end-to-end, City could never feel comfortable with a single goal lead and Kante was close to his second when a goalbound shot was deflected behind by Fernandinho.
The Uruguay worldwide and his Reds team-mates at the time finish in second place and four points adrift of eventual champions Manchester City despite playing some entertaining football.
It is a measure of the London club's progress under new boss Lampard, who has had to rely on youth due to a transfer embargo, that losing to a side that won the treble last season is considered a disappointment.