Joselu and the returning Alexander Meier scored the goals for Armin Veh's men, who moved eight points clear of the drop zone with five games of the season remaining.
Defeat dented Mainz's hopes of qualifying for the Europa League next season with three points separating them from sixth-placed Wolfsburg, who have a game in hand.
Frankfurt were claiming before the game that their local rivals had stolen a march on them in recent years and that they were no longer the biggest club in the region.
Few were buying it, though, and the way they approached the game was more akin of a team with a great deal of belief in their own strength and superiority.
Stefan Aigner headed the first chance of the game against the post before another header, this time from Joselu, was saved well by Loris Karius.
Mainz did not pose a threat until shortly before half-time when Eric-Maxim Choupo-Moting's header was deflected wide.
Kevin Trapp denied Choupo-Moting shortly after the break before Frankfurt took full control of the game, and took the lead in the 52nd minute.
Mainz failed to clear their lines from a free-kick and the ball reached Sebastian Jung on the right. His cross was headed goalwards by Joselu, and although Karius reached the ball, he could not keep it out.
Aigner had the ball in the back of the net again midway through the second half, but the goal was ruled out for offside.
The game was therefore still delicately poised with Mainz becoming increasingly dangerous until Meier sealed the win.
Jung's pass to Aigner split the Mainz defence and set up Meier, who was left with only Karius to beat, and he marked his return after a injury with a goal to seal Frankfurt's win, and probably their place in the Bundesliga next season.