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'
|Andre Gomes can play in Busquets role, insists Luis Enrique|
|Aguero´s dangerous tackle scared me, says Conte|
|Guardiola: We are killing the players|
|Bournemouth announce plans for new stadium|
|Former Bayern Munich and Real Madrid star Ze Roberto to play beyond 43rd birthday|
|Barcelona friendly awaits new Chapecoense coach Mancini|
|Arsenal are privileged to have Sanchez and Ozil - Monreal|
|Watzke denies agreement to discuss Aubameyang transfer with Madrid|
|Paris Saint-Germain v Nice: Champions hunting down shock leaders|
|Giggs tells Rashford how to end his goal drought|
|Manchester United without Shaw, Smalling for Tottenham clash|
|Willems inks PSV renewal|
|Costa and Conte scoop Premier League awards|
|Conte detained on suspicion of assault|
|Strootman ban for derby ´simulation´ overturned|
|Mourinho demands more goals from Rooney|
|Bobo preserves Sydney´s unbeaten start in Cup final rematch|
|Luis Enrique: I don´t dare predict if Messi will renew|
|Mourinho admits changing style for United|
|Sanchez talk is disrespectful, says Conte|
|Sassuolo 0 Genk 2: Visitors seal top spot|
|Sterling back for City as Guardiola predicts tough Leicester test|
|Mourinho still the ´Special One´ for Pochettino|
|Matic return leaves Conte with Fabregas dilemma|
|Guardiola expects greater impact from City youngsters next season|
|Klopp defends Karius after Bournemouth blunder|
|Pirlo visits Chelsea - but Conte is not signing him|
|Ronaldo, Modric rested for Deportivo clash|
|Tuchel hails returning Reus|
|Klopp has ´no idea´ on Sturridge return|
|´My players are intelligent and good people´ - Zidane on Ronaldo´s taxes|
|Atletico to play at ´Wanda Metropolitano´|
|Real Madrid to rest Benzema and start Morata against Deportivo|
|Ancelotti rules out Draxler bid as Bayern prepare for barren transfer window|
|Ighalo calls on Watford to sign Mikel|
|Pardew wants defender and striker to bolster Palace survival push|
|Moyes: M´Vila doesn´t have the fight for Sunderland|
|Leipzig only built to earn Red Bull money - Watzke|
|Shenhua director blasts CSL imports... but desperate for Tevez deal|
|Ribery: Bayern my last club in Europe|
|Hughes targets Arsenal fans to help Stoke end dismal away run|
|83 suspects, 98 clubs ´impacted´ in football abuse probe|
|Fowler pleads with Liverpool to keep ´top quality´ Sturridge|
|Reus ´100 per cent different´ on comeback|
|Ibrahimovic ´super happy´ for rejuvenated Mkhitaryan|
|Vertonghen: Football needs Mourinho|
|Title triumph went to Leicester´s heads, admits Ranieri|
|Conceicao named new Nantes coach|
|LaLiga lead means nothing - Zidane|
|Chapecoense add two stars to badge in wake of air disaster|
|Blatter accuses Infantino of lack of respect|
|Austin injury compounds Puel´s misery|
|Gestifute publishes further evidence of ´Ronaldo tax compliance´|
|Pioli eyes further Inter improvement|
|´I feel s***´ - Van Dijk blasts Southampton after Europa League collapse|
|Mourinho marvels at Mkhitaryan mentality after Zorya stunner|
|Southampton 1 Hapoel Be´er Sheva 1: Late Van Dijk leveller not enough as visitors progress|
|Inter 2 Sparta Prague 1: Eder double sends hosts out on a high|
|Vieira wanted Arsenal coaching opportunity|
|Vieira hopes MLS experience puts him in frame to replace Guardiola|
|Mkhitaryan: I waited a long time for this|
|Zorya 0 Manchester United 2: Mkhitaryan magic sends Mourinho´s men through|
|Ranieri urges Leicester players to fight for their futures|
|Cellino banned for 18 months over McCormack transfer|
|Koeman demands reaction from dropped Barkley|
|Tevez unsure on Boca future amid China speculation|
|Bradley vows to fight for his job at Swansea|
|Koeman speaks out on Depay, Schneiderlin links|
|Wenger unconvinced by World Cup expansion plans|
|Kovac brothers sign new Frankfurt deals|
|Selling Sturridge would be a mistake, says Rush|
|UEFA opens disciplinary proceedings against Besiktas, Dynamo Kiev|
|Filipe Luis suffers thigh tear|
|Kashima Antlers 2 Auckland City 1: Late Kanazaki header the difference|
|Suarez´s Barca renewal already done, says Bartomeu|
|Barcelona invite Chapecoense for Joan Gamper Trophy|
|Arsenal would have a chance against Real Madrid, insists Wenger|
|FIFA chief Infantino calls for zero tolerance on child abuse|
|Sanchez will not leave Arsenal for China - Wenger|
|Dybala delighted with Juventus return|
|Rashford desperate to learn from Ibrahimovic|
|Weigl not ready for Real Madrid - Tuchel|
|Why Zidane must drop Ronaldo at the Club World Cup|
|Barton: They built me up into a Neymar-Messi type|
|Shakhtar aware of Barca interest in Srna - Fonseca|
|Mets hitting coach believes Tebow can make it to MLB|
|Aubameyang reiterates Madrid dream after Bernabeu show|
|Zidane praises Benzema after 50th Champions League goal|
|Aubameyang deserves 99 per cent of credit - Reus|
|Neymar: There´s only one Ballon d´Or winner and it´s Messi, not Ronaldo|
|Magiera hails Legia victory as for ´all of Poland´|
|Tuchel thought Aubameyang had blown chance to equalise|
|Pochettino confident Spurs are back on track|
|Santo hails Porto´s mature performance|
|Lyon proved we can compete with Europe´s best - Genesio|
|Slutsky unsurprised by apparent Premier League interest in Dzagoev|
|Jardim frustrated as Monaco finally lose|