Substitute Colin McMenamin hoisted Livingston off the bottom of the Premier league and kept up their hopes of beating the drop.
McMenamin struck 11 minutes from time with a shot that deflected off Motherwell defender Stephen Craigan into the net. Motherwell should have put the match out of sight before then, but Roddy McKenzie had an inspired match in the Livingston goal.
Gordon Marshall missed the game because of 'flu and Barry John Corr took over in goal for Motherwell.
Motherwell started brightly and could have had a goal inside the first couple of minutes when Jim Paterson found McDonald and he lofted the ball over McKenzie. But there was not enough pace on his effort and it was easily mopped up by the Livingston defence.
Martyn Corrigan then had a couple of decent effort from distance – McKenzie failed to hold the first and was helped out again by his defence with McDonald hovering, but the goalkeeper smothered Corrigan's second attempt.
Livingston responded and Corr had to have two attempts to hold an angled shot from Robert Snodgrass.
Motherwell always looked the more menacing going forward, and from a Kevin McBride corner, Paterson header was netbound until Burton O'Brien cleared off the line.
It was only a temporary respite as Motherwell took the lead in the 18th minute. Greg Strong failed to deal with a through ball from Paterson and was robbed by McDonald, who drilled a low shot past the stranded McKenzie.
Another mistake by the Livingston defence – this time Goran Stanic – gave McDonald another shooting chance after 28 minutes but this time McKenzie did well to touch his low shot past for a corner.
Paterson could have added to Motherwell's lead before half-time when he headed on a Steven Hammell corner, but McKenzie was ideally positioned to save.
Craig Easton should have equalised in the 49th minute when he was not picked up at a corner but he swiped at his shot and Corr saved easily.
McKenzie saved from Corrigan and then produced a stunning save to keep out a volley from McDonald as Motherwell went in search of a killer second goal.
Motherwell were dominant but the second goal proved elusive. Substitute Richie Foran should have put the game out of reach when McKenzie push the ball into his path but he shot tamely at the goalkeeper and another chance was lost.
Livingston had little to offer up front, although the introduction of McMenamin made them more direct. He had the final say when his shot from the edge of the area beat Corr with the aid of a deflection off Craigan.
Snodgrass could even have won it in injury-time but completely missed his kick in front of goal.