Second-placed Well were barely out of cruise control after Michael Higdon gave them an early lead, and the points proved vital with their main rivals for that position - Inverness - also victorious on Saturday.
Motherwell took the lead in the ninth minute with the SPL's leading scorer Higdon meeting Chris Humphrey's cross at the far post and heading past a stranded Steve Simonsen.
Henrik Ojaama could easily have doubled the lead, but Dundee were also lively before the break with Gary Harkins forcing a fine save from Darren Randolph, who also parried a header from Kyle Benedictus.
The game was always going to rest on who got the vital second goal, and it was Motherwell who assumed control just after the hour mark when Law began to stamp his class on the game.
Keith Lasley moved into space down the flank and his cross was perfect for Law to guide past Simonsen with his head.
John Baird passed up a chance to get one back for Dundee seconds later but the game was over as a contest with 12 minutes left to play when Law grabbed his second.
The former Rotherham midfielder curled a lovely shot past Simonsen from the edge of the box after Tom Hateley played a corner in his direction.
Motherwell were able to cruise through the remaining minutes and cut their deficit to Celtic to 12 points, although the reigning champions are in action on Sunday against St Mirren.
The defeat was John Brown's first since taking over as manager at Dens Park and leaves them with a mountain to climb if they are to make up the 13 point deficit they have on the Buddies with games running out.