The Poland international slotted home two spot-kicks in the final 12 minutes to secure Jurgen Klopp's three badly needed points at the Coface Arena
Having lost to Wolfsburg and Bayern Munich in their last two league outings, Pierre-Emerick Aubameyang gave Dortmund the lead after 70 minutes as he curled home a superb free kick.
However, Mainz were level within four minutes when Eric Maxim Choupo-Moting converted a penalty, after Lukasz Piszczek was penalised for a shove on Yunus Malli in the box.
Dortmund regained the lead through Lewandowski with 12 minutes remaining, as he calmly slotted home a spot-kick of his own, after Elkin Soto denied a certain Aubameyang goal with his hand.
The defender was given a straight red for his actions before Lewandowski tucked away the third penalty of the match in injury time to secure Dortmund's victory.
Piszczek made his first start for Dortmund since May's Champions League final, with Kevin Grosskreutz moving into midfield alongside Sven Bender, who started despite breaking his nose against Napoli on Tuesday. Aubameyang replaced Henrikh Mkhitaryan in Dortmund's forward line.
Zdenek Pospech was named in the Mainz starting XI, meanwhile, despite having been taken off in last Sunday's 3-2 win over Werder Bremen, while Shinji Okazaki led the line having scored four times in his last four Bundesliga games.
The hosts began brightly and saw long-range efforts from Pospech and Johannes Geis spilled by Roman Weidenfeller within the opening 11 minutes as they looked to record their third straight Bundesliga victory.
Park Joo-Ho was next to threaten, with his acrobatic overhead kick from inside the area comfortably dealt with by the Dortmund goalkeeper.
The visitors' first effort on goal came through Lewandowski after 25 minutes, with the Poland international expertly controlling a Marco Reus cross before miscuing his effort and firing wide.
Bender was replaced by Nuri Sahin just after the half-hour mark before both sides hit the crossbar in the final minutes of the opening period.
Mainz defender Stefan Bell first saw his header hit the woodwork from a corner, before Aubameyang's dipping strike was tipped onto the frame by Loris Karius.
Weidenfeller was then called on to make a great save from Choupo-Moting's fierce drive two minutes into the second half before Okazaki fired over from the left-hand side of the area.
It was Dortmund who took the lead 20 minutes from time, though, with Aubameyang's expertly-hit free kick putting the visitors ahead.
However, their joy was shortlived as Piszczek bundled Malli over in the area before Choupo-Moting levelled from the spot.
Jurgen Klopp's side hit back almost immediately when Lewandowski converted from 12 yards following Soto's cynical handball to deny Aubameyang a second.
And there was time for Lewandowski to grab his second of the game, scoring from the spot again after Erik Durm was fouled in the area by Karius to ensure Dortmund recorded their fourth successive win at Mainz.