Although the Potters' first goal at Old Trafford in 30 years, a Dean Whitehead header from an unmarked position, had cancelled out Javier Hernandez's opener, Nani curled home the winner from 20 yards.
The win sees United move clear of neighbours City, who travel to Arsenal on Wednesday.
Scott Dann snatched a dramatic 89th-minute winner for Birmingham at Blackpool as Alex McLeish's side moved away from the relegation zone with a 2-1 victory.
Dann met Roger Johnson's header across goal and took a touch before dispatching a cool half-volley past Richard Kingson.
Birmingham had led at half-time through Alexander Hleb's early solo goal, but DJ Campbell pegged them back with 22 minutes to go with a half-volley.
Fulham eased the pressure on manager Mark Hughes as they climbed out of the drop zone with a romping 3-0 win over West Brom.
A howling error from Baggies goalkeeper Scott Carson gifted them the lead as he failed to deal with a Simon Davies' shot straight at him.
Davies then turned provider for goals two and three, which were virtually identical as Clint Dempsey and then Brede Hangeland headed in corners from close range.
Birmingham and Fulham are now both two points clear of trouble, in 15th and 13th place respectively.