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'
|Madrid can dream of trophies under Zidane - Raul|
|Ancelotti: Italy job is a decade away|
|Reus will become a monster, says Dortmund boss Tuchel|
|Young Tottenham stars don´t know their limits - Lloris|
|Niang happy at Milan despite Leicester interest|
|Ticket price rise means more tourist fans, warns football supporters chairman|
|Ogbonna revels in first West Ham goal|
|Copa Libertadores Review: Huracan, River Plate advance to group stages|
|Klopp backs Benteke to rediscover goalscoring form|
|Turan will not leave Barca for China - agent|
|Beating Chelsea more difficult without Mourinho - Motta|
|Tuchel praises Dortmund for ´perfect game´|
|Klopp rues Liverpool wastefulness in FA Cup loss|
|Allegri: Chelsea rumours unfounded|
|Bilic feels weight of history after Liverpool win|
|Coupe de France Review: Second tier Sochaux stun Ligue 1 Monaco|
|West Ham 2 Liverpool 1 (aet): Ogbonna sinks Klopp´s men in cup thriller|
|Football League Review: Rhodes rescues a point to send Boro top|
|Stuttgart 1 Borussia Dortmund 3: Aubameyang helps Tuchel´s men into last four|
|Kyle Allen blames chaotic Texas A&M culture on Johnny Manziel era|
|Dortmund fans stage protest against ticket prices for Stuttgart game|
|Bayer Leverkusen 1 Werder Bremen 3: 10-man hosts dumped out|
|Ferdinand fears title wilderness for United|
|Carvalho lands new Sporting deal with €45m buy-out clause|
|Ben Arfa out for at least four weeks with hamstring injury|
|Neville´s Valencia woes welcomed by Crespo|
|Ozil key to Arsenal´s title hopes - Rosicky|
|Zika threat could keep Solo from Rio Olympics|
|Blanc pleased to have solved David Luiz matter|
|Atletico midfielder Partey suffers thigh strain|
|Dickov: Leicester title run built to last|
|Guardiola not a menace for our players, says Luis Enrique|
|Mexico v Senegal: Osorio believes in youngsters|
|Celta Vigo v Sevilla: Krohn-Dehli not taking Copa del Rey final for granted|
|Madrid confirm Marcelo shoulder dislocation|
|Injury rules Chiellini out of crucial Juve games|
|Oblak extends Atletico deal|
|Blanc hints PSG could move for Ben Arfa|
|Luis Enrique urges Neymar to cope with off-field distractions|
|Carrick: Manchester United not throwing in towel|
|Neville determined to turn things around at Valencia|
|Guardiola hails Lewandowski professionalism amid Real Madrid and PSG rumours|
|Guardiola wary of ´aggressive´ Bochum|
|Premier League reveals new logo|
|West Ham open Payet contract talks|
|I could leave Barcelona for Guardiola, says Busquets|
|Giggs can be Manchester United´s Guardiola - Robson|
|Zidane has everything to become a great coach - Ancelotti|
|Carragher: Liverpool got it wrong on ticket prices|
|Neymar will be at Barcelona for years, claims director|
|Eder talks up Inter´s Scudetto chances|
|Larsson: Watching Barca is like playing FIFA|
|City recruit Wilkinson hoping to debut in Melbourne derby|
|Allegri will join Chelsea, says former coach|
|Zanetti: No need to compare Maradona and Messi|
|Vardy: I never expected Leicester to top Premier League|
|Capello: Ronaldo has at least three years at the top|
|Klopp hoping for Sturridge revival|
|Bilic wants new contract to keep Payet at West Ham|
|Shelvey can be as good as Cabaye - Sissoko|
|Rooney leaps to Depay defence after Chelsea error|
|Januzaj, Varela injured in United Under-21s win|
|Valencia v Barcelona: Luis Enrique eyes record as Neville stands on the brink|
|Espanyol 0 Real Sociedad 5: Vela scores stunner in ruthless display|
|Cruyff would have preferred Guardiola at Manchester United|
|Questioning Ronaldo is an insult - Aduriz|
|Peterborough United v West Brom: Berahino set for another chance|
|Barcelona confirm medical tests for Messi|
|Ajax defender Riedewald out for season with broken ankle|
|Barcelona is the best place for Neymar - Mascherano|
|Clement axed as Derby head coach|
|Chelsea defender Zouma out for the season|
|Rodgers: I´ve turned down Swansea and four other clubs since Liverpool|
|Russia to invite Blatter and Platini to World Cup 2018|
|Robben rejoices as Ribery resumes Bayern training|
|Terry as good as ever, says Azpilicueta|
|Struggling Rotherham sack Redfearn|
|Courtois feels Champions League or FA Cup glory would save Chelsea´s season|
|Paris Saint-Germain v Lyon: Genesio vows ´unlucky´ visitors will have a go|
|Liverpool cancel Q&A to discuss ticket price furore|
|Klopp: Liverpool won´t follow Payet to the toilet|
|Bochum v Bayern Munich: Alonso braced for intense month|
|Ronaldo: Two more years at Real Madrid and then we´ll see|
|No problems with Kagawa says Dortmund boss Tuchel|
|Laporte denies saying he would reject Barcelona|
|Impressive Sturridge and returning Coutinho in contention - Klopp|
|Leicester were afraid of Italian tactics - Ranieri reveals his secret|
|Coentrao sustains fractured foot|
|Barcelona director at ease over Neymar future|
|Mata touched by reaction of Chelsea fans|
|Alonso: Guardiola departure not a distraction|
|Thiago Silva: PSG can stay unbeaten all season|
|Cristiano Ronaldo will keep breaking records - Hugo Sanchez|
|Bilic: Klopp will be back because he is a leader|
|Mancini dismisses Inter title bid as ´a closed story´|
|Guardiola took Bayern for a ride - Hamann|
|Mihajlovic demands more from Balotelli|
|Campbell urges clubs to give black managers a chance|
|Marchisio expects Napoli showdown to be decisive|
|You can´t expect to score lots of goals in every game - Modric|
|FFA hit Wanderers with show cause notice|
|We did not deserve Madrid defeat - Granada coach|
|Mata frustrated with Chelsea draw|
|Valencia won´t sack Neville - Mendieta|
|Senna makes Villarreal return|
|Spalletti: Roma need to cut out lapses|
|China will break $100m transfer fee - Cahill|
|Ranieri: Don´t look down|
|Guardiola reinvented football - Alaba|
|Tottenham fear no one - Kane|
|Flores believes Tottenham are Premier League´s best|
|Henderson: Walkout no excuse for Sunderland collapse|
|Neville bullish about Valencia future|
|Ramos: Modric key for Madrid|
|La Liga Review: Luis Enrique matches Guardiola record, Modric rescues Madrid|