Two goals in three first-half minutes from Stefan Bell earned Martin Schmidt’s men all three points, while they hit the woodwork twice in the second half against an off-colour Schalke team.
The result means the two sides are separated by just five points going into the final four games of the season while Werder Bremen have the chance to close to within a point and Hoffenheim to within two of Schalke with wins this weekend, leaving Roberto Di Matteo’s men far from assured of a place in Europe next season.
Some poor finishing early on prevented Schalke from taking the lead in what proved to be their best spell of the entire game.
Mainz were rarely a threat in the opening exchanges, but a corner in the 28th minute led to them taking the lead.
Niko Bungert failed to get any decent contact on the set-piece, but the loose ball fell kindly for Bell to turn in unmarked from five yards out.
Three minutes later, a corner from the other side was headed in by Bell, who doubled his tally for the season as Schalke showed they had not learnt their lesson.
Had the Royal Blues been at home, the boos would have been deafening as they left the field at half-time, but it was the Mainz fans’ cheers which accompanied the teams to the dressing rooms.
Di Matteo probably raised his voice enough there to get his message across and Schalke emerged like they had for the first half with Jefferson Farfan failing to crown a good spell of pressure by shooting wide from 15 yards.
It was still too little from Schalke, who should have fallen three behind in the 71st minute when Ja-Cheol Koo had the goal at his mercy, but struck against the crossbar.
Johannes Geis hit the post with a direct free-kick before Schalke finally woke up, when it was already too late.
Leon Goretzka and Julian Draxler both hit the top of the crossbar with speculative efforts, but that was not enough to prevent the Royal Blues from falling to a defeat which leaves their minimum aim for the season, a place in Europe, in jeopardy.