The striker netted his first goal since August 2008 when he cancelled out Steve Jennings' header early in the second half at Fir Park on Boxing Day.
MacDonald, making only his third Scottish Premier League appearance of the season following a recurring hamstring injury, completed his treble in 17 minutes with two more clinical finishes.
The scoreline looked unlikely at half-time after Jennings had capitalised on some sustained pressure to net his first Motherwell goal.
But the hosts started sloppily after the break and never recovered as they lost their fourth successive game.
Manager Jim Gannon had opted for experience after the 6-1 defeat by Rangers, with Stephen Craigan, Jim O'Brien and John Sutton recalled alongside Keith Lasley, who made his first SPL start of the season.
St Johnstone, with Murray Davidson in for Filipe Morais following last weekend's victory over St Mirren, had the first clear opening when MacDonald's lay-off found Chris Millar in yards of space inside the area but Steven Saunders got across well.
Motherwell had a great chance in the 16th minute when Lasley and Yassin Moutaouakil combined to beat the offside trap. The right-back rolled the ball in for Sutton, who turned a man 10 yards out but his low shot lacked power and Graeme Smith gathered at the second attempt.
The lively O'Brien then made some space for himself at a throw-in and fired in a 20-yard shot that Smith got down to hold.
John Ruddy pushed over Millar's powerful strike from the right side of the box but the hosts soon took a grip of the game.
Smith could only parry Sutton's header from a Tom Hateley free-kick but Lukas Jutkiewicz could not connect with the goal gaping and Lasley ran on to hit the post from three yards.
Lasley soon created two good chances but Jutkiewicz volleyed over and a reverse pass just would not fall quickly enough for O'Brien with Smith rushing out to block his lob.
But the pressure paid off in the 39th minute. Lasley's reverse found Moutaouakil in space and his arching cross hung up perfectly for Jennings to power a header into the roof of the net from eight yards.
Saints brought on Liam Craig and Steven Milne at half-time and the substitutes immediately carved out an opening when Milne's flick found Craig on the left side but Ruddy saved his shot.
Dave Mackay scooped over after Motherwell struggled to clear a free-kick and another cross paid off for the visitors in the 54th minute.
Jody Morris ran on to Craig's cross and chested the ball into the path of MacDonald, who lashed home from close range.
Lasley had a low shot saved but Saints went ahead in the 57th minute when MacDonald controlled a high ball 12 yards out, turned Saunders and fired home.
Gannon brought on Jamie Murphy and Paul Slane and Motherwell had a penalty claim for handball rejected when Gary Irvine blocked Sutton's header.
But MacDonald completed the first hat-trick in the SPL this season following a 70th-minute breakaway when he headed home at the back post after Millar had got away from Craigan on the right wing.
Gannon replaced Jutkiewicz with Chris Humphrey, to the vocal disapproval of the Motherwell support, and Sutton's header from a Hateley cross bounced to safety off Smith's head after striking a post.
Sutton had another header saved but Motherwell never seriously threatened a comeback.