The Robins put behind them some recent nervous performances, including a defeat against promotion rivals Sheffield United last weekend, to trounce their mid-table opponents.
Adam Rooney was the star, netting a double to add to efforts from James Collins and Massimo Luongo.
MacDonald's team are now in sixth place, four points ahead of three clubs chasing the last play-off position - which Swindon occupy with only two matches remaining.
MacDonald said: "The lads played well, although they got a bit sloppy in the second half. At home, we have always made chances and this time we took them."
It was Swindon's first victory at home since January 19 and ended a costly run of three successive defeats.
MacDonald said: "The players had to give the fans something to cheer after losing at Sheffield United and I'm pleased we managed to do that.
"The crowd enjoyed themselves because we got the early goals and played some decent stuff. We got four goals and created plenty of other chances but you score goals as a team and concede goals as a team.
"The whole group put in a good performance and we need to keep doing that for the remaining league matches and hopefully three more in the play-offs."
- Sports & Recreation
- Sheffield United