Adam Chapman marked his home debut with a superb hat-trick as promotion-chasing Mansfield made it seven wins in a row.
The on-loan midfielder converted the rebound after Matt Green's shot was saved by Richard O'Donnell and then added a second from Luke Jones's pass.
Danny Whitehead missed two chances for Stockport before Lindon Meikle played in Green for his 18th of the season.
Paul Marshall's 30-yarder provided a consolation for the visitors before Chapman curled home a superb clincher.
Despite the margin of victory, the Stags remained in third place, but closed the goal-difference gap on leaders Wrexham - who were beaten by Dartford - and Kidderminster, who have the same number of points.