Germany were pushed all the way by an inspired Algeria on Monday before Andre Schuerrle and Mesut Ozil eventually secured them a 2-1 extra-time victory to send them into a mouthwatering World Cup quarter-final meeting with France.

The north African outsiders played with energy and confidence to regularly expose a static German defence and Islam Slimani found the net with an early diving header ruled out for offside, but they were indebted to goalkeeper Rais Mbolhi for a great double save to deny Toni Kroos and Mario Goetze which kept the match scoreless at halftime.

Mbolhi made another excellent save from a close-range Thomas Mueller header to take the match into extra time but the fitter-looking Germans were in control by then and took the lead within 90 seconds of the extra period when substitute Schuerrle cleverly dragged in a low Mueller cross.

Ozil banged in the second in the 120th minute and though Abdelmoumene Djabou replied in added time Germany extended their remarkable record of reaching at least the quarter-finals in every World Cup they have entered since 1938 and gave them their first win in three attempts against Algeria, who famously beat them in a 1982 World Cup group game.

Algeria could have levelled through Mostefa, who snatched an effort wide from 10 yards after Germany failed to deal with a corner.

Ozil then made the game safe in the closing stages, lashing high into the net after Schurrle had been denied just in front of the goalline by Essaid Belkalem, although there was one final twist as Djabou converted a right-wing cross at the back post to net a deserved consolation for Algeria.

Germany will next face France on Friday at the Maracana Stadium in Rio de Janeiro