Substitute Andre Schuerrle and Mesut Ozil scored in extra time and Germany survived Algeria's aggressive play with a 2-1 win Monday in Porto Alegre, Brazil, to reach the World Cup quarterfinals for the ninth consecutive time.

All three goals came in extra time after Algeria dominated for long stretches during the opening 90 minutes.

"It was a victory of will power," Germany coach Joachim Loew said. "We had major problems in the first half to organize the way we played. We made simple mistakes, which invited the opponents to start counterattacks."

Germany finally took the lead when Thomas Mueller provided a cross from the left flank that was slightly behind Schuerrle. The Germany forward dragged his left leg and backheeled the ball into the far corner in the 92nd minute, leaving goalkeeper Rais M'Bohli with no chance.

Ozil added the second in the 120th and substitute Abdelmoumene Djabou pulled one back in injury time for Algeria.

Three-time champion Germany next faces 1998 winner France on Friday at the Maracana Stadium in Rio de Janeiro.

With the temperature a chilly 57 degrees and a light rain falling at times, the pace was high at the Estadio Beira-Rio but the goals didn't come until the end.

Ozil thought he had put the result out of reach when he pounded in a rebound after a shot from Schuerrle was cleared off the line by defender Esseid Belkalem, but Djabou volleyed in a minute later to make the last seconds count.

Perhaps inspired by the "Disgrace of Gijon" at the 1982 World Cup, when Germany and Austria supposedly conspired to oust Algeria in the group stage, the northern African nation outmatched Germany's intensity for long stretches in an entertaining match.

Algeria was playing in the second round of the World Cup for the first time.

Paul Pogba scored with a late header to finally break Nigeria's stubborn resistance and Joseph Yobo added an own-goal as France won in Brasilia to reach the quarterfinals. ... Four years ago, France crashed out of the group stage, shamed a nation by going on strike and was jeered by its fans and lambasted by politicians in the fallout from an embarrassing tournament. ... Nigeria goalkeeper Vincent Enyeama had just made a superb save to tip over Karim Benzema's header, but he flapped at the ball from the ensuing corner and Pogba pounced in the 79th minute to nod in his first goal of the tournament. ... Yobo, who announced his international retirement after the game, turned the ball into his own net in stoppage time under pressure from France substitute Antoine Griezmann. ... African champion Nigeria had a goal ruled out for offside in the 19th minute after Emmanuel Emenike poked home Ahmed Musa's cross from the left.