The victory keeps Schalke's slim hopes of securing a European place for next season alive.
Their lead did not last long and was cancelled out by a powerful Michel Bastos effort from just outside the box which found the bottom corner.
Schalke took the lead midway through the first half, when after a neat turn and pass by Julian Draxler, Huntelaar tucked the ball past the goalkeeper from close range.
Huntelaar and Raffael both missed further chances before the break, as Schalke began to take control of the match.
The pair were involved again shortly into the second period, this time to better effect as Raffael's corner was headed in by Huntelaar on 58 minutes.
The Dutchman completed his hat-trick 10 minutes later with a carbon copy of his second goal, heading in from the Brazilian's corner.
Draxler missed the chance to increase the lead with a couple of snapshots from the edge of the box, before Huntelaar failed to hit the target after being played in by Raffael towards the end.
It didn't matter, though, as Schalke secured the win to move within seven points of third-placed Bayer Leverkusen with just three games to play.