The Argentina striker slalomed through United's defence and arrowed a finish high into the net in the 78th minute, cutting second-place City's deficit to 12 points with seven rounds remaining.
The result ended United's 4 1/2-month unbeaten run in the league and will retrieve some local pride for the champions. It surely came too late, though, to have any effect on the destination of the title.
"We showed we deserved to stay closer to the title but it is finished," said City manager Roberto Mancini, sticking to the stance he has adopted for the past three weeks.
The balance of power remains in the red corner of Manchester for the time being, but Mancini will feel his team put down a marker for next season.
Controlling possession for long periods with its extra man in midfield, City gave United an uncomfortable evening at Old Trafford. It was nothing like the 6-1 drubbing City delivered at the same stadium last season but this win was just about deserved.
"A derby is always a special game for us and to be able to win is massive," City captain Vincent Kompany said. "I do believe the way we finish this season will have an impact on how we do next season. This is a good win to have under our belt and we will take it into the next season."
Kompany scored the winner in last season's April meeting between the two rivals, continuing City's last-gasp charge to a first title in 44 years, but it was his own goal here that looked to have denied his team victory.
The Belgium centre back inadvertently deflected in Phil Jones' bundled header from Robin van Persie's devilish in-swinging free kick in the 58th minute, cancelling out James Milner's 51st-minute opener for City that took a slight ricochet off the knee of Jones.
Either side could have won it in an end-to-end final half hour, but it was Aguero who made the difference with a goal that had echoes of his title-winning strike in the final seconds of last season.
"There were lots of plus signs. Our form is good, I have no complaints. If you look at the whole thing, it's not a bad day for us in terms of the performance level," Ferguson said in an upbeat assessment of his team. "You don't want to lose a derby game, but we're OK."
The alarm bells may not be ringing just yet but Van Persie's goal drought extended to 10 matches, Wayne Rooney was again nowhere near his best and United's midfield was over-run at times. Since the heartbreaking loss to Real Madrid in the Champions League last 16, United have lost two games (also at Chelsea in an FA Cup quarterfinal replay) and only beaten relegation-threatened Reading and Sunderland 1-0.
From a position of marching to the title, United may yet stumble to the line.
"If you look at the history of this club, we always make things difficult for ourselves," Ferguson said.
The Manchester derby has become the biggest match in England — and one the world's most-watched fixtures — in recent years, and the pace and intensity of the teams' play was frightening at time, especially in the first half.
"It is easy to see why these were the best two teams in the country; the evidence was there tonight," said Ferguson, who had been seeking his 900th win as United manager in all competitions.
It was City which had more composure, although it needed a slice of fortune to open the scoring.
Carlos Tevez was standing in an offside position and looked to be blocking David De Gea's line of sight when Milner's deflected shot wrong-footed the United goalkeeper and nestled into the corner. It was the first goal United had conceded in the league in 678 minutes.
City's lead was brief thanks to Kompany's intervention but Aguero, starting on the bench after recent injury problems, had the final say. Introduced as a 71st-minute substitute for the ineffective Samir Nasri, the nippy striker collected Yaya Toure's short pass before embarking on a mazy dribble that ended with a unstoppable finish inside De Gea's near post.
"We wanted to come here and put in a performance," man-of-the-match Milner said, "and I think we did that."Suggest a correction