Second-placed Liverpool had earlier piled on the pressure with a 4-0 home win over Blackburn Rovers and champions United once looked set to be overhauled at the top of the table when Kenwyne Jones cancelled out Paul Scholes's opener.
Macheda, however, turned in Michael Carrick's wayward shot with his first touch seconds after coming on in the 75th minute.
Thanks to his decider, United restored one-point lead over nearest rivals Liverpool, who have 70 points from 32 games.
Chelsea nearly threw away a four-goal lead at home to Bolton Wanderers but hung on for a 4-3 win which saw the visitors pull three goals back in nine minutes.
Guus Hiddink's side retained third with 67 points, six clear of Arsenal who won 4-1 at Wigan Athletic.
Tottenham Hotspur moved up to eighth and boosted their hopes of qualifying for Europe after overcoming West Ham United 1-0 at home.
In the other end of the table, Newcastle United gave Alan Shearer his first point as manager, but remain in the relegation zone after a 1-1 draw at Stoke City.
Middlesbrough recorded a rare league 3-1 win over fellow strugglers Hull City while West Bromwich Albion let a lead slip in drawing 2-2 at Portsmouth.
Considering next Wednesday's Champions League quarterfinal second-leg tie against Porto, Manchester United manager Sir Alex Ferguson rested Edwin Van der Sar, Patrice Evra and Cristiano Ronaldo at Sunderland.
Scholes gave United a 19-minute lead, heading Wayne Rooney's fine cross into the far corner before Jones bundled home from close range to equalize 10 minutes after the restart.
Macheda came off the bench, in place of Dimitar Berbatov, to turn home the winner on 76 minutes to claim a priceless three points.
Chelsea maintained their title challenge in dramatic fashion.
They seemed to have secured a victory after an hour by opening up a 4-0 lead through Michael Ballack, Didier Drogba with two and a Frank Lampard penalty.
But Bolton took advantage of their defensive vulnerability and they were suddenly trailing 4-3 as Andy O'Brien, Chris Basham and Matt Taylor each scored from 70th to 78th minute.
Although the visitors went on to threaten to draw, Chelsea held their nerves and Petr Cech kept out any further goal.