Wrexham flew out of the traps at the One Call Stadium and were gifted the opener inside two minutes as MacDonald inexplicably turned Ollie Rathbone's cross into his own net.
Rathbone was a real threat on the left flank and saw his teasing cross clip the outside of the far post minutes later.
The Stags - who had lost eight of their past nine matches across all competitions - were on the ropes and had Stephen McLaughlin to thank for hacking away Jay Rodriguez's goalbound effort after Sam Smith beat goalkeeper Scott Flinders to the ball.
Just when Nigel Clough may have been fearing the worst, MacDonald turned from villain to hero as he stretched to guide Keanu Baccus's cross into the net at the back post to level proceedings with his first competitive goal for Mansfield and his side's first at home in more than a month.
On his first league start since joining Wrexham from Hull City in January, Ryan Longman was unable to adjust to guide Rathbone's latest inviting delivery on target at the back post.
The visitors were dealt a blow before half time as Andy Cannon had to be replaced by Matty James after sustaining what appeared to be a serious knee injury.
Phil Parkinson's side started the second half as they did the first and came close to regaining the lead after Mansfield failed to clear James' free-kick, although Cleworth rifled against the crossbar after latching on to George Dobson's scuffed effort.
But Wrexham's pressure was rewarded in the 58th minute as Seb Revan's cross fell to Cleworth who drilled into the net from 20 yards out - his eighth goal of the campaign in all competitions.
George Maris' tame effort was easily saved by Arthur Okonkwo at the other end as Wrexham's second half dominance guided them to another crucial victory in their quest for a third successive promotion.
It means Wrexham have won three away English Football League games in succession for the first time since August 2003.