Report: Stevenage 0-1 Stags
Mansfield are now in 8th position in Sky Bet League Two, a point behind Stevenage in 7th, and host Portsmouth at One Call Stadium on Saturday before Crawley on the final day.
And it was MacDonald who created the Stags' first opportunity in the fourth minute, slipping the ball forward for frontman Shaq Coulthirst who could only drag his shot wide from inside the box.
Two minutes later, midfielder Ben Whiteman struck goalwards but home goalkeeper Jamie Jones was well behind it. Seconds later, the home custodian launched a route one ball upfield and after Stags retreated quickly to thwart Kaylen Hinds' initial forward run, the striker's shot was blocked by Hayden White inside the area.
Mansfield goalkeeper Jake Kean was well-placed to comfortably claim a 30-yard free kick from Dale Gorman and moments later, defender Rhys Bennett had to be alert at the near post to snuff out a right-wing cross.
Mark McKee, part of a three-man Stevenage attack, then planted a shot into the side netting after Ronnie Henry's long throw.
Midfielder Tom Pett saw a 25-yard attempt sail well wide in the 13th minute as Stevenage maintained their foot on the gas.
Stags then pushed forward but inviting crosses from Hayden White and Mal Benning from the right and left flanks respectively, were unable to find an amber shirt.
Mansfield though grew stronger as the half went on and frontman Danny Rose tried his luck from the edge of the box, but it was straight at Jones.
With 24 minutes played, a mazy run by Coulthirst earned him a free-kick after he was upended 30 yards from goal. And from the set-piece, MacDonald's sweetly-taken floater was deflected to go behind for a corner.
The game entered a scrappy 15 minute spell before Stags forced another corner in the 40th minute after MacDonald's free-kick from near the touchline was deflected behind.Â
And from Joel Byrom's delivery, Rose's glancing header was hooked off the line by Jobi McAnuff.
Stags pressed forward again and on 43, Rose's ferocious drive from 12 yards was somehow deflected behind for a corner.
But the striker wasn't to be denied a third time as Mansfield broke the deadlock in the final minute of the half.
Stevenage were unable to clear the ball in a crowded box, and after Krystian Pearce, Bennett and crucially George Taft had touches which the home side failed to defend, Rose slammed the ball into the top of the net from 10 yards.
Stags' momentum carried into the second half and on 53, Whiteman saw his low shot spin against a home defender to go out for a corner.
Assistant referee Joe Clark had to be replaced in the 56th minute by fourth official Andrew Fox.
Coulthirst then won another free-kick for Mansfield, from which MacDonald smashed over the bar, 23 yards out.
Shortly before the hour, MacDonald embarked on a lung bursting run, midway inside his own half, and showed great skill to fly past two home players. But after reaching the penalty area, the ex-Oxford man scuffed his final attempt after a terrific sprint with the ball.
On 65, Kean rose high to grab on to a looping header from Luke Wilkinson following a high ball into the box.
Three minutes later, Rose got the better of Wilkinson to surge into the area, but the defender recovered to block the eventual shot by the Stags' striker.
It was to be Rose's last slice of action as he was replaced by Matt Green in the 71st minute.
At the other end, Ben Kennedy's hit could only find the roof of the Stags' net.
In the 74th minute, George Taft was substituted for Lee Collins.
As expected in the final 15 minutes, Stevenage pressed for a leveller, but Stags remained dogged in defence.
With 88 minutes on the clock, midfield tiger Jamie McGuire took the place of Alex MacDonald.
And after the blast of the final whistle, the Stags' management and squad walked over to a highly vocal away following of 389 to celebrate a crucial and well-merited victory.
UNUSED SUBS: Day, Franks, Wells, Ntlhe
UNUSED SUBS: Jensen, Potter, Hoban, Arquin