Three-time champion Germany, which has now advanced past the second round at nine consecutive World Cups, will next face 1998 winner France on Friday at the Maracana Stadium in Rio de Janeiro.
With the temperature a chilly 14 degrees Celsius (57 degrees Fahrenheit) 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 and dominated early on. A goal from Islam Slimani was waved off for offside in the 17th, one of many opportunities for the Algeria striker.
At the start of the second half, Germany put Schuerrle on for Mario Goetze in an attacking midfield and came out better organized.
In the 55th, Germany captain Philipp Lahm unleashed a hard shot that an outstretched Rais did well to push wide with his fingertips.
Still, Algeria continued to produce dangerous counterattacks. In the 72nd, Neuer had to come out of his area to head away the danger with Slimani chasing.
In the 88th, Germany’s inability to find the target turned theatrical for a moment when Mueller appeared to fall during a free kick.
Germany will next face France, who overcame a Nigerian test in the round of 16, on Friday at the Maracana Stadium in Rio de Janeiro.