Updated

Mainz, Germany (SportsNetwork.com) - Gojko Kacar scored in the 87th minute to lead Hamburg to a crucial 2-1 win at Mainz that lifts the club out of the bottom three.

Hamburg has spent much of the second half of the season battling relegation, and Kacar's goal allows the club to move into 14th place, one point above the drop zone with three matches remaining.

The visitors got the only goal of the first half on an own goal from Mainz's Julian Baumgartlinger, while the hosts equalized in the 76th minute through substitute Yunus Malli.

But Kacar rescued the win for Hamburg with his first league goal of the campaign three minutes from time to hand the club its second successive victory.

Pierre-Michel Lasogga went close with header for Hamburg that narrowly sailed over the crossbar, while goalkeeper Rene Adler made a fine stop at full stretch to deny Mainz the opening goal from Baumgartlinger's shot.

Baumgartlinger was involved again at the other end and he found the back of the net, albeit his own. Heiko Westermann's cross was whipped into the box and Baumgartlinger got his head on the ball, looping it over goalkeeper Loris Karius and inside the far post.

Karius made a nice stop to deny Lasogga and keep his side within a goal, while Ja-Cheol Koo nearly equalized with a low shot that struck the post.

Malli leveled the contest in the 76th minute when he scored after being set up by Jairo Samperio, only for Kacar to snatch the win for Hamburg three minutes from time.

Sunday's other contest saw Ibrahima Traore score the winning goal in the 85th minute to help Monchengladbach to a 2-1 win at Hertha Berlin, allowing the club to regain third place.