The German side needed to win by a scoreline of 3-1 or better to overtake their opponents for second place in Group L and got over the line with a dramatic last-ditch strike.