Algeria started the match as underdogs but gave Germany a run for their money at least in the regulation 90 minutes.
Even though Germany were by far the better side on display in the match, the former champions failed to break a spirited Algeria defence in the regulation 90 minutes, forcing the game into extra-time.
But the Germans finally rode on their class to find the back of the net in the second minute of additional time through substitute Andre Schurrle.
Chelsea's Schurrle, who came in after the interval for Mario Götze, came to Germany's rescue in the second minute of extra-time after both the teams failed to opening the scoring in the regulation 90 minutes.
Schurrle scored the first goal of the match in the 92nd minute with a sublime flick off Thomas Muller's pass before Mesut Ozil struck in the final minute of additional time to double Germany's lead.
Even though Abdelmoumene Djabou scored an 11th-hour goal for the Algerians it proved too little, too late for the spirited North Africans.
The Germans will meet European rivals France at the historic Maracana Stadium in Rio de Janeiro on Friday after the Les Bleus ended Nigeria's campaign with a 2-0 win in

Germany, however, were made to work hard by a physical Algerian side, playing in the last-16 of the World Cup for the first time.
Earlier in the day, France struck twice in the second half to prevail over Nigeria in another last-16 game at the Estadio Nacional in Brasilia.
France broke the deadlock in the 79th minute through Paul Pogba before doubling their lead in additional time through an own goal by Joseph Yobo.
Nigeria started on bright note and enjoyed the lions' share of possession at least in the opening 20 minutes of the game.
Nigeria’s persistent efforts resulted in a free-kick just outside the French circle in the 17th minute when Peter Odemwingie was brought down by Blaise Matuidi but the Super
Eagles failed to cash in on the chance.
Two minutes later Emmanuel Emenike found the back of France net with a deft touch only to be ruled out marginally off side by the line referee.
Nigeria certainly was on top at the opening exchanges as France played the second fiddle.
But France got their acts back quickly and had a great chance in the 22nd minute only to be denied by a brilliant Vincent Enyeama in front of Nigeria goal.
Enyeama showed brilliant reflexes to keep out Paul Pogba's powerful shot after a one-two with Mathieu Valbuena.
France enjoyed a rare spell of possession in the last 12 minutes of the opening half but to no avail as their forwardline lacked creativity.

The Les Bleus had one of the best chance of the half in the 40th minute when Valbuena clipped a ball into the onrushing Debuchy whose effort was off target.

The Newcastle man should possibly have done better with that despite the box being crowded with bodies.
French strikers Olivier Giroud and Karim Benzema were almost anonymous in the opening half as Nigeria came out with stout defending.
Just like the opening half, Nigeria started livelier of the two teams after the change of ends.
Odemwingie came close to breaking the deadlock for Nigeria but his fierce strike was well saved by skipper Hugo Lloris in front of French goal.
France coach Didier Deschamps' decision to bring in Antoine Griezmann in place of Giroud was bang on target as it imbibed fresh life into their forwardline.
Benzema then looked threatening for the first time in the match in the 70th minute but his effort was cleared off the line by Victor Moses.
Seven minutes later, France came tantalisingly close to breaking the stalemate when Yohan Cabaye's effort rattled the woodwork.
But France's consistent pressure finally bore fruit when Pogba headed in from their eighth corner after Enyeama flapped at a cross which found Pogba in a clear position.
If not for that one mistake, Enyeama stood like a rock in front of the Nigeria goal as six minutes from whistle he sticked out a huge hand to deny Griezmann.
It was all over for Nigeria as France doubled their lead in the extra-time when Yobo scored an own goal while trying to clear Valbuena's low ball towards Griezmann.


Latest News from Sports News Desk