© Getty Images
With five minutes of the first half remaining, Ramos saw his strike from inside the box crash against the post as the teams went into the break on level terms.
In the 66th minute, Mainz took the lead as Okazaki slotted in Jairo Samperio's ball across the box from close range.
Dortmund were given the chance to get back into the match four minutes later as they were awarded a penalty following Okazaki's handball inside the box.
Ciro Immobile stepped up to take the spot kick, but saw his low effort saved by Karius.
Dortmund found themselves further behind in the 74th minute when Matthias Ginter turned Samperio's cross into his own net.
The visitors pressed for an equaliser, but they were unable to find a way past their opponents as their three-match winning run came to an end.