Germany were given a major scare before beating Algeria 2-1 on Monday to book a FIFA World Cup quarter-final meeting with France.
After a pulsating 90 minutes in Porto Alegre had ended goalless, Chelsea forward Andre Schurrle - on as a half-time substitute for Mario Gotze - cleverly flicked in Thomas Muller's low cross two minutes into extra-time to give Germany the lead.
Mesut Ozil added a second late on to wrap up victory for Joachim Low's side, before Algeria, who performed admirably throughout, gained a consolation through Abdelmoumene Djabou.
The result meant Algeria were unable to exact revenge for the "Disgrace of Gijon", when West Germany and Austria played out a mutually beneficial 1-0 scoreline that saw both sides through from the group at the expense of Algeria in the 1982 finals in Spain.
With many pointing to that infamous match as motivation for Vahid Halilhodzic's men in the build-up, Algeria flew out of the blocks in the opening 20 minutes, cutting through the German backline on a number of occasions and seeing an Islam Slimani goal disallowed for offside.
The African nation - making their first appearance in the second round - continued to impress, but Germany, who will now face France at the Maracana on Friday, finished the stronger and remain on course to reach the semi-finals of a fourth successive World Cup.
Algeria made a flying start and Manuel Neuer had to make a sliding tackle to deny Slimani an effort on goal from wide on the left in the ninth minute, after the goalkeeper had initially misjudged a charge from his line.
Sofiane Feghouli wasted a good position six minutes later, blazing the ball wildly across goal from the byline with two team-mates better placed.
Slimani converted Faouzi Ghoulam's wonderful cross from the left with a diving header in the 17th minute, but the referee's assistant correctly ruled that the Sporting Lisbon man had strayed offside, before Ghoulam flashed another effort narrowly off target as Algeria continued to dominate.
Germany gradually grew into the game towards the end of the first half, Muller heading wide and Ozil testing Rais M'Bolhi with a dipping effort.
Yet Algeria hit back in the 39th minute, Mehdi Mostefa thumping in a shot from 25 yards which deflected off Jerome Boateng and past the left-hand post with Neuer completely wrong-footed.
M'Bolhi made a superb double stop two minutes later, parrying Toni Kroos' drive away and then springing to his feet to keep out Gotze's rebound.
Germany enjoyed a more assured opening to the second period, Schurrle seeing an effort deflected just wide before Skhodran Mustafi, who replaced Mats Hummels (flu) in defence with Boateng switching to centre-back, headed straight at M'Bolhi from Kroos' delivery.
Philipp Lahm went close in the 55th minute, his curling effort diverted wide by an acrobatic save from M'Bolhi.
As the game wore on the play became stretched and Slimani sent a rasping effort from distance straight into the arms of Neuer 15 minutes from time.
Germany responded strongly and Muller ought to have scored his fifth goal of the tournament shortly afterwards, but his powerful header was beaten away by M'Bolhi.
Muller had another clear chance moments later, stabbing the ball wide after a glorious touch to bring the ball under control, while Bastian Schweinsteiger was unable to seriously trouble M'Bolhi with a weak header from Lahm's chipped pass.
Low's side then struck early in the first extra period, Schurrle adjusting brilliantly to backheel Muller's cross from the left into the net.
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.
|Coach: J. Löw|
for M. Götze 46'
for S. Mustafi 70'
for B. Schweinsteiger 109'
|APOEL eye Europa League despite winless road streak|
|Silva disappointed by ´childish´ errors|
|Slutsky happy to keep ´intrigue´ alive|
|A-League Preview: Brisbane begin life after Mulvey|
|Eredivisie Preview: Ajax targeting improvement|
|Shakhtar did not lack motivation - Shevchuk|
|Bayern lament two errors, Guardiola proud|
|Valcke: It will ´take years´ to rebuild FIFA´s reputation|
|Luis Enrique ´never fed up´ of Messi magic|
|Valverde pleased with Bilbao triumph|
|Messi revels in Champions League milestone|
|Loss was a ´crying shame´ - De Boer|
|Suarez relieved to get off the mark for Barca|
|Pellegrini puts Aguero among best in the world|
|Cavani wants top spot|
|Howedes sorry for Schalke collapse|
|Sporting Lisbon 3 Maribor 1: Slimani helps fire hosts into second place|
|Concord Rangers 0 Mansfield Town 1: Palmer edges League Two side through|
|Mourinho salutes ´complete´ Chelsea after Schalke stroll|
|Lopetegui revels in Porto professionalism|
|MK Dons 2 Rochdale 2: Green rescues hosts a point|
|Manchester City 3 Bayern Munich 2: Aguero the hero as City rekindle Champions League dream|
|Shakhtar Donetsk 0 Athletic Bilbao 1: Hosts qualify despite poor performance|
|Paris Saint-Germain 3 Ajax 1: Strike duo terrorise Dutch side|
|APEOL 0 Barcelona 4: Messi breaks record after Suarez opener|
|Schalke 0 Chelsea 5: Blues clinch top spot in style|
|Serbia turn to Curcic|
|Inter v Dnipro: Juan wants early qualification|
|Sporting-Maribor delayed as lights go out in Lisbon|
|Garcia upbeat despite late setback|
|The making of Lionel Messi: How it all started for the Champions League´s record goalscorer|
|Tottenham v Partizan: Pochettino´s men look to seal qualification|
|Messi breaks Champions League scoring record|
|Wolfsburg v Everton: Distin buoyed by good run|
|Allegri expects improved away display|
|Rodgers: First goal crucial for Liverpool confidence|
|CSKA Moscow 1 Roma 1: Late leveller keeps Russians in the hunt|
|Ancelotti not worried about record|
|BATE 0 Porto 3: Belarusians knocked out but go into the record books|
|Klopp looking forward to Champions League distraction|
|Parish urges Warnock to stop ref rage|
|UEFA Europa League Preview: Celtic and Inter seek home wins to advance|
|Diame could make Hull return on Saturday|
|QPR lose Sandro to knee injury|
|Juanmi fractures arm|
|Wilshere out for ´a while´ - Wenger|
|Wenger hits back at Usmanov|
|De Jong back in training for Newcastle|
|Chelsea ´head and shoulders´ above rest - Giggs|
|Stevens returns to Stuttgart|
|Cheltenham sack Yates|
|Giggs open to United exit to further career|
|Sampaoli relaxed after Copa America draw|
|Pekerman eyes Copa America revenge|
|Time for City to produce - Nasri|
|Copa Sudamericana Preview: River search for form ahead of Superclasico|
|K. League Preview: Cup winners Seongnam eye safety|
|Argentine Primera Division Review: Racing Club beat River Plate to go top|
|Guardiola: Desperate City are dangerous|
|Paraguayan Division Profesional Review: Libertad back on top as Cerro Porteno slip up|
|Brazil to meet Colombia at Copa America|
|Koeman backs ´great´ Forster|
|Lambert delighted with makeshift Villa defence|
|Koeman remains confident of top-four finish|
|Granada 0 Almeria 0: Visitors hold on to move out of bottom three|
|Genoa 1 Palermo 1: Hosts rue Pinilla miss in lively draw|
|Aston Villa 1 Southampton 1: Saints spoil Lambert´s 100th game|
|No let-up from Bayern - Guardiola|
|Turkish Super Lig Review: Besiktas and Fenerbahce gridlocked, Yanal makes winning start|
|Basel v Real Madrid: Ancelotti approaching winning record|
|Russian Premier League Review: Zenit extend advantage, Torpedo win marred|
|Mourinho not interested in Reus|
|Pellegrini dismisses Messi rumours|
|Anderlecht v Galatasaray: Faint hopes remain alive in Belgium|
|Luis Enrique: Barca must beat APOEL|
|Indian Super League Preview: Materazzi keen to maintain momentum, Goa host Kerala|
|Arsenal v Borussia Dortmund: Klopp visits Emirates amid switch rumours|
|Fer concerned by QPR away form|
|Shakhtar must not underestimate Athletic - Lucescu|
|Indian Super League Review: Chennaiyin well-placed for post-season, Delhi win|
|Atletico Madrid v Olympiacos: Atleti on the brink of last 16|
|Dragons take American football player on trial|
|Di Matteo has no thoughts of Chelsea revenge|
|Vermaelen could require surgery|
|Destiny in Roma´s hands - Garcia|
|Ludogorets v Liverpool: Rodgers demands improvement|
|Malmo v Juventus: Pogba issues rallying cry|
|Blanc demands killer instinct against Ajax|
|Bayer Leverkusen v Monaco: Germans looking to progress|
|Aguero and Jovetic fit to face Bayern|
|Ancelotti reveals contract talks|
|Slutsky targeting Champions League last 16|
|PSV receive Guardado boost|
|Ter Stegen waiting for Barcelona chance|
|Allardyce hopeful Carroll can stay injury-free|
|Arsenal must be ruthless - Arteta|
|Veh resigns from struggling Stuttgart|
|Juventus have ´more quality´ this season, says Pogba|
|Copa America win can restore Brazil´s confidence – Marin|
|Lallana issues rallying cry|
|Fritz confident Bremen can turn things around|
|Bruce backing Hull to stay out of trouble|
|Lambert determined to transform Villa|
|Valdez: Suarez needs ´miracle´ for Copa America|
|Real Madrid heading to Australia for ICC|
|Martinez: Lukaku can become ´best striker in the world´|
|Koeman slams ´crazy´ Christmas fixture list|
|Iniesta, Vermaelen unavailable for Cyprus trip|
|Zenit v Benfica: Pereira, Lima set to return for Portuguese champions|
|Inzaghi sorry for derby stalemate|
|Colombian Primera A Review: Medellin on cusp of final, Santa Fe deny Huila|
|Mancini ´very happy´ with derby draw|
|Peruvian Primera Division Review: Sporting Cristal beaten|
|Liga del Futbol Profesional Boliviano Review: Late Blooming spark sends Oriente second|
|Venezuelan Primera Division Review: Trujillanos stay top, Metropolitanos embarrassed|
|Liga MX Review: Pachuca, Pumas UNAM reach play-offs|
|MLS Review: Wins for Galaxy, Revolution|
|Ecuadorian Primera A Review: Top three fail to score, Olmedo win big|
|Brazilian Serie A Review: Cruzeiro retain title|
|Chilean Primera Division Review: Universidad Chile held, Colo Colo go top|
|Costa Rican Primera Division Review: Cartagines into fourth|
|Uruguayan Primera Division Review: Champions Nacional win again|