Leipzig's midfielder Naby Deco Keita (R) scores during the German first division Bundesliga football match FSV Mainz 05 v RB Leipzig in Mainz, southern Germany, on April 5, 2017Leipzig's midfielder Naby Deco Keita (R) scores during the German first division Bundesliga football match FSV Mainz 05 v RB Leipzig in Mainz, southern Germany, on April 5, 2017 (AFP Photo/THOMAS KIENZLE)
After runaway leaders Bayern had their 20-match unbeaten run ended by a 1-0 defeat at Hoffenheim on Tuesday, RB were made to work for the win at Mainz to narrow the gap.
"We scored two quick goals in the second half to give us some peace, but at the end it was really difficult as Mainz went all out," said RB's playmaker Emil Forsberg.
Sweden's Forsberg assisted both goals including a deft backheel from a cross from which Sabitzer gave RB the lead on 48 minutes.
Werner then added Leipzig's second, his 15th league goal this season, four minutes later when he got on the end of Forsberg's cross to leave the visitors in control at 2-0 up.
But Mainz sprang into life with 30 minutes to go as their Spanish midfielder Jairo converted a penalty on 69 minutes.
Mainz's Levin Oztunali had the ball in the RB net again seconds later, but the effort was ruled offside.
Keita, who scored twice on his return at the weekend after collapsing following his team's defeat against Wolfsburg on March 11, then dribbled through the Mainz team and slotted home on 81 minutes.
Japan's Yoshinori Muto headed Mainz's second goal in the dying stages, but Leipzig held on.
The win keeps RB on course for a Champions League place next season, but Mainz are just above the relegation places.
This was Mainz's fourth straight defeat to increase the pressure on coach Martin Schmidt.
Hertha Berlin's Champions League ambitions suffered another set-back as they crashed to a third straight defeat in losing 1-0 at Borussia Moenchengladbach.
Gladbach's 19-year-old defensive midfielder Laszlo Benes gave the hosts an early lead and Thorgan Hazard hit the post in the second half.
Hertha are now sixth, 10 points from the Champions League places with seven games left, while Gladbach are ninth.
Bayer Leverkusen pulled away from the relegation mire to go 10th with a 2-0 win over bottom side Darmstadt thanks to goals by Germany pair Julian Brandt and Kevin Volland.
Wolfsburg, the 2009 champions, are now just a point from the relegation places after their 1-0 defeat to Freiburg thanks to striker Florian Niederlechner's second-half winner.
Second-bottom Ingolstadt boosted their survival chances with a 3-2 win at Augsburg to leave them just four points from safety as midfielder Almog Cohen scored twice.