Rafael van der Vaart opened the scoring with an outstanding strike, volleying in from the corner of the area after 23 minutes.
Gladbach were quickly level through a Martin Stranzl header, but they could not keep parity going into the break.
Artjoms Rudnevs put Hamburg back ahead with the last action of the first half, as he converted from close range after a fine cross from Milan Badelj.
Hamburg had a golden opportunity to extend their lead from the penalty spot 10 minutes into the second half, when Stranzl was sent off for a last-ditch challenge.
Van der Vaart took the penalty after a delay, but his effort hit the post.