Macheda grabbed a goal in each half, making it three goals in two games for City since he signed on loan at the end of January.
The defeat leaves Charlton without a win since Boxing Day and stuck in the bottom three.
The Addicks handed home debuts to striker Reza Ghoochannejhad and winger Astrit Ajdarevic, while fellow new signing Yohann Thuram-Ulien started in goal.
All three players were signed from Standard Liege, another of the football clubs owned by Charlton's new owner, Belgian millionaire Roland Duchatelet.
City had skipper Paul Robinson back from suspension for this basement battle.
Neither team had won a league game in 2014 before facing each other at a sunny but soggy Valley.
Although the threadbare pitch was not conducive to attractive attacking football both sides produced an entertaining match.
Iranian international forward Ghoochannejhad went down under looking for a penalty after going shoulder to shoulder with Will Packwood but had no joy and the City defenders were incensed with his gamesmanship.
Ajdarevic tried to lob Blues keeper Darren Randolph but the attempt lacked the necessary subtlety or accuracy.
Macheda turned a low shot wide, while Lee Novak was also off target as Birmingham ventured forward.
City went ahead on 22 minutes when Manchester City loanee Emyr Huws put in a free kick from Birmingham's right wing and Macheda got enough of a head on it to claim his second goal in as many games.
Only a heavy touch prevented Chris Burke from making it two when Tom Adeyemi played through a terrific ball for him but Thuram was out smartly.
Jordan Cousins then had an opportunity to level but failed with only Randolph to beat as his tame shot was saved.
Randolph also saved a spectacular scissors-kick effort from Ajdarevic, then pushed away a half volley through a crowded box from Johnnie Jackson.
The City stopper, who has played every minute of the league season, was determined to keep his seventh clean sheet of the campaign and had to be sharp to push away a shot from Ghoochannejhad which looped off a defender along with a long-range effort from Marvin Sordell.
Birmingham clung on to their lead and were content with the occasional foray forward in the second half with Adeyemi shooting wide.
But there was a certain inevitability about their clincher 10 minutes from time when they caught Charlton on the break.
Free summer signing Adeyemi made a breakaway dash from the halfway line before sliding the ball in for Macheda and he took a touch before beating Thuram-Ulien.