Kompany rose highest to head home David Silva’s corner at the end of a first half that had seen United frustrate the home side with a defensive display.
United were more positive after the break but City remained resolute.
City now lead United courtesy of their eight-goal superior goal difference with two games remaining in the season.
The win caps a remarkable comeback for City, whose title bid appeared to be over at the start of this month when a defeat at Arsenal left them eight points behind their fierce local foe at the top of the table.
It now promises to be a gripping final two weeks in the Premier League with City next travelling to Newcastle before hosting QPR and United facing Swansea at Old Trafford ahead of a final-day trip to Sunderland.