The on-loan Manchester United striker headed home unmarked in the 71st minute to give Rovers a first success in seven games while extending Wednesday's winless start to the Sky Bet Championship season to an eighth game.
After a frustrating opening half-an-hour for both sides at Hillsborough, Wednesday almost went in front from the first meaningful attempt on goal.
Rovers captain Rob Jones made a mess of Michail Antonio's cross from the right and the resultant loose ball fell to Atdhe Nuhiu eight yards out, only for the towering striker to divert his strike wide of Ross Turnbull's goal.
The home side continued to have the better of the game and they had another chance to open the scoring three minutes before the break.
Antonio burst forward on the counter-attack following a cleared Doncaster corner but his ball into the middle bounced too high for Jermaine Johnson and the Jamaican's acrobatic attempt was comfortably stopped by Turnbull.
The visitors failed to register a shot on goal during the open 45 minutes and Jeremy Helan's injury time effort at the other end, which Turnbull easily saved, capped off an uneventful first period.
Rovers finally mustered an effort at goal seven minutes into the second half when defender Jones headed wide from Paul Keegan's right-wing free-kick.
Jones' centre-back partner Bongani Khumalo then headed straight at Owls keeper Chris Kirkland from another Keegan set piece before Nuhiu saw a goal-bound volley blocked and a header fly over at the other end.
Wednesday began to reaffirm their first-half superiority and, after winger Johnson had a header cleared off the line, Miguel Llera's back-post header, from Stephen McPhail's cross, was brilliantly turned behind by keeper Turnbull in the 63rd minute.
Macheda was then denied by Kirkland after he wriggled clear in the box and shot from an acute angle.
The Italian did not have to wait long for another chance, though, and duly headed the only goal of the game 19 minutes from time.
Half-time substitute James Coppinger was allowed time and space on the left to curl a right-footed delivery to the far post for Macheda to power home past the helpless Kirkland.
Midfielder Richie Wellens came close to doubling the away side's advantage five minutes from the end but his low effort was saved by Kirkland and scrambled away.
Wednesday pushed in vain for an equaliser and almost conceded a second when keeper Kirkland went forward for a corner.
The ball was cleared to Rovers substitute Mark Duffy but he fired wide of the left-hand upright with a shot from the halfway line.