Two goals in extra time have fired Germany into the last eight of the World Cup at the expense of a tenacious Algeria team.
The African side started the stronger of the two, though they were unable to create any real opportunities until the 17th minute when Islam Slimani headed the ball into the net from an offside position, only for referee Sandro Ricci to correctly disallow it.
Two minutes later Algeria were causing more problems for the Germans as Faouzi Ghoulam managed to get the better of Mesut Ozil before flashing his shot wide of the far post.
Die Mannschaft began to grow into the game as the first half progressed, with Toni Kroos combining well with Bastian Schweinsteiger, only for Ozil's resulting effort to be parried away by Rais M'Bolhi.
Hilal Soudani's effort from range very nearly led to the breakthrough, but the deflected effort ended up narrowly wide of the target after leaving goalkeeper Manuel Neuer wrong-footed.
Despite creating the better chances, M'bolhi was called on to produce a fine double save to deny first Kroos's 25-yard drive down low, before quickly getting up to block Mario Gotze's rebound from close range to ensure that the scores remained level at the break.
Andre Schurrle was introduced at the interval, and he came close to making an instant impact only for his deflected shot to end up wide for a corner to the relief of M'Bolhi.
The African keeper was needed once more seconds later to deny Germany on the 55-minute mark, when Phillip Lahm's effort from just outside the area was tipped wide.
Yet it was not all Germany's way, as Slimani managed to test Neuer following a quick break from the Fennec Foxes as the game entered the final 15 minutes.
Shortly after Thomas Muller fizzed a cross into the box which Schweinsteiger could only glance wide, while Muller soon thought he had himself scored with a headed effort of his own which was once more kept out by M'Bolhi.
The pressure was beginning to tell as the game edged towards the end of normal time, and Muller was presented with another chance to open the scoring. The German forward was played in over the top before cutting inside Halliche but his poked effort was wide of the post.
Extra time started with a bang as Germany took the lead just minutes in when Schurrle headed home a cross from Muller from close range.
Algeria's best chance to equalise came moments later when the ball fell kindly for Mehdi Mostefa inside the box, but his snap-shot flew narrowly wide of the post.
Germany made certain of their place in the last eight with a late strike from Ozil, who smashed the ball home from close range, though Algeria set up a grandstand finish.
Abdelmoumene Djabou netted a consolation goal for the Africans right at the death, but couldn't prevent his side from bowing out of the competition.