Germany had to battle all the way into extra time to beat Algeria 2-1 in their World Cup second-round clash on Monday, crushing the North Africans' dream of revenge and setting up a quarterfinal duel against fellow former champion France.