The hosts were quick out of the starting blocks as Suat Serdar fired over the bar in the third minute before rattling the crossbar four minutes later.
Serdar was involved again on 13 minutes but failed to capitalise for the third time, lashing a volley over from close range after the ball fell kindly to him from a left-wing cross.
Dortmund grew into the game and almost took the lead on the stroke of half time when Pierre-Emerick Aubameyang was played clean through on goal but the Gabon striker's effort drifted wide.
The hosts began the second period with more urgency and duly took the lead on 55 minutes when Sokratis Papastathopoulos produced a composed finish in at the far post after Omer Toprak's header off a corner bounced off the near post.
By the latter stages of the encounter Peter Stoger's side were in control and Mainz stopper Robin Zentner had to pull off several smart saves to keep his side in the game, most notably a point-blank effort from Shinji Kagawa on 80 minutes.
However, Dortmund were able to kill the game off in the 89th minute as Aubameyang showed great vision to find Kagawa with a cheeky pass inside the box, the ensuing first-time shot sailing low into the middle of the opposition goal.
Mainz (3-5-2): Zentner; Balogun, Gbamin (Hack 46'), Diallo; Donati (Maxim 64'), Serdar, Frei, Latza, Brosinski; Quaison (Holtmann 76'), Berggreen
Borussia Dortmund (3-4-3): Burki; Toprak, Sokratis, Schmelzer; Toljan, Kagawa, Weigl, Guerreiro (Sahin 90'); Yarmolenko, Pulisic (Dahoud 70'), Aubameyang