The hosts went in front through Mohammed Abdellaoue, who was in the starting XI for the first time since Matchday 3. After Mainz failed to clear their lines from a Stuttgart attack, the Norwegian forward prodded home from close range when Vedad Ibisevic's point-blank diving header had been saved by Loris Karius.
Stuttgart had comfortably held their visitors at bay for most of the first half, but Shinji Okazaki's equaliser just before the break - the result of a defensive mix-up - gave a hint of the fighting spirit in the Mainz camp. That determination came to the fore again shortly before the final whistle, when Benedikt Saller finished from a tight angle following Joo-Ho Park's superb ball over the top.
New signing Ja-Cheol Koo came on as a second-half substitute for the guests, but struggled to make an impact on the game. However, it mattered little as Mainz now move onto 27 points, eight ahead of Stuttgart