The Fennec Foxes held their own against their more-fancied opponents as the scoreline remained goalless after 90 minutes.
Yet substitute Andre Schurrle put the Germans ahead just 90 seconds into extra time, before team mate Mesut Ozil smashed home just a minute from the end to seal the African nation’s fate. Algeria did bring a goal back in the dying seconds through Abdelmoumen Djabou, but it was too little, too late as Germany marched on into the last eight.
Algeria had reached the Last 16 for the first time in their history, and were on the back foot early on as German midfielder Bastein Schweinsteiger stung the palms of Algerian goalkeeper Rais Mbolhi with a venomous shot from range on 13 minutes.
Yet Africa’s highest-ranked nation found their way back into the game, and rippled the back of Manuel Neuer’s net just three minutes later through a diving Islam Slimani header, which was adjudged to be off-side.
Algeria kept up the good spell of pressure however, as good work down the left from Hilal Soudani played in an on-rushing Faouzi Ghoulam who fizzed his shot across Neuer’s goal for Algeria’s best chance of the half.
A busy Mbohli kept his side in the game five minutes before the break with a fine double save, first denying Toni Kroos and then Mario Gotze’s follow-up effort as the two sides headed into the interval all square.
Yet the Germans signalled their intent early in the second half as the ever-present Mbohli denied a goal-bound Kroos effort before producing a spectacular finger-tip save from a long-range Philipp Lahm strike minutes later.
Die Mannschaft kept up the pressure, yet could not find a way past the resilient Algerian shot-stopper, who heroically blocked Thomas Muller’s header ten minutes before time.
The deadlock remained unbroken at 90 minutes, signalling a minimum of an extra thirty minutes in Porto Alegre.
And it was the Germans who took the early advantage, taking the lead in just the second minute of extra time after a fine run down the left by Thomas Muller who sent in a low cross for Andre Schurrle to flick past a sprawling Mbohli in the Algerian goal.
Mehdi Mostefa came close to levelling matters 11 minutes into the added time, his snap shot from an Algerian corner going narrowly wide.
Mbohli was once again called into action three minutes from the end, this time denying substitute Christoph Kramer from registering his name on the score sheet with a fine save at his near post.
Yet there was nothing he could do just two minutes later as Schurrle rounded the Algerian glove-man, as the Chelsea forward’s goal-bound effort was cleared off the line. Yet the skewed clearance fell at the feet of an unmarked Mesut Ozil who smashed home from close range to seal progression for Joachim Low’s charges.
There were a few jitters seconds later as substitute Abdelmoumen Djabou latched onto a perfectly-weighted cross from the right to finish with a powerful strike past Manuel Neuer, but it was little consolation in the dying moments of the game as the Germans held on to secure a quarter-final berth for the 13th time at a FIFA World Cup.
They now face high-flying France, who dispatched African champions Nigeria earlier in the day, at the Maracana on Friday evening, as Africa’s hopes at this year’s event came to a disappointing end.