Raja Casablanca survived a scare to defeat Auckland City 2-1 and qualify for the quarter-finals of FIFA's Club World Cup on Wednesday.
The Moroccan outfit - playing in their home country - were heavy favourites and dominated the first half at Stade d'Agadir.
They took a deserved lead in the 39th minute when Mouhssine Iajour atoned for an earlier miss with a stylish left-foot finish.
Fijian Roy Krishna shocked Casablanca by pouncing on a horrendous defensive error to level just after the hour mark, but Abdelilah Hafidi spared the blushes of the hosts with a close-range finish in the 92nd minute.
Casablanca will now play North American champions Monterrey of Mexico in the last eight.
Casablanca - the only side involved in the tournament who are not champions of their continent - entered the match on the back of a four-match winless run domestically.
They were buoyed by a partisan home crowd against amateur outfit Auckland City – winners of the OFC Champions League – and started brightly, with Adil Karrouchy volleying an excellent cross from captain Mohsine Moutaouali over in the seventh minute.
Iajour was sent through on goal in the 22nd minute but had his effort saved by the outstretched leg of Auckland goalkeeper Tamati Williams.
He made amends six minutes before half-time though, as a Karrouchy ball played him in.
Iajour beat Auckland skipper Ivan Vicelich before shooting past Williams from a tight angle.
Casablanca nearly had a second three minutes into the second half, with another excellent Karrouchy ball headed behind by John Irving, but dropped back after that and allowed Auckland into the match.
Christopher Bale shot wide before a smart Issam Erraki intervention kept out Krishna from a clever free-kick.
Auckland did level proceedings in the 63rd minute, as a dreadful defensive mix-up – which saw three players fail to clear and Mohamed Oulhaj and Karrouchy tackle each other – allowed Krishna in.
The forward kept his composure to slot past the onrushing Khalid Askri from outside the penalty area and his goal spurred Auckland on.
They started to have more of the ball and Krishna proved a continued threat, but a late Casablanca attack ended Auckland's hopes of reaching the quarter-finals.
The influential Karrouchy supplied the cross and, although Oulhaj's header was well saved by Williams, Hafidi was on hand to send the home crowd into raptures.
|3||Z. El Hachimi|
|Coach: F. Benzarti|
for C. Chtibi 74'
for M. Iajour 85'
for A. Hafidi 90+4'
|Higuain rejects extension from Napoli|
|Zamora returns to Brighton|
|West Ham can cope without Valencia - Gold|
|Wickham loses on Palace debut|
|Guardiola: No problem with Matthaus and Effenberg comments|
|Cartabia excited by Deportivo loan|
|Lyon confirm Rafael deal|
|Hysaj agrees deal to follow Sarri to Napoli|
|Rafael says his goodbyes to Manchester United|
|Dos Santos ready to get going with Galaxy|
|Pochettino rejects Soldado exit talk|
|Metatarsal misery for Mulumbu|
|Benitez: Benzema and Bale going nowhere|
|Mihajlovic: Ibrahimovic would make Milan title contenders|
|Hughes not taking any risks with Bojan|
|Guardiola relishing Audi Cup test|
|Di Maria ´taking a step up´ - Silva|
|Leicester bring in defender Benalouane|
|Deulofeu doubtful for Premier League opener|
|West Ham striker Valencia out for three months|
|UEFA: Qarabag-Celtic to go ahead|
|Palace seal Wickham swoop|
|Ronaldo and Benzema to miss Audi Cup|
|Marotta: Juventus could lose Pogba|
|Kante completes Leicester switch|
|Khedira ruled out for two months|
|FA accepts Mourinho criticism of Wembley surface|
|Robben rubbishes injury talk|
|Marchisio expects Milan title challenge|
|Rafael set for Lyon move|
|Celtic ´seeking reassurances´ over Qarabag pitch|
|Wenger beating Mourinho does not affect Chelsea - Zouma|
|Rooney moved by Everton welcome|
|Mancini not worried by lack of Inter goals|
|Coloccini wants to finish career at Newcastle - McClaren|
|Ramsey: Pressure to win trophies is nothing new|
|Terry: Wembley defeat could be a ´blessing in disguise´|
|Blatter not running for IOC re-election|
|Bendtner: Wolfsburg can challenge Bayern for Bundesliga honours|
|Liverpool relishing Britannia return, says Henderson|
|Everton big enough to keep Stones - Martinez|
|MLS Review: Fire stun Dallas as goals dry up|
|New Atletico signings excite Raul Garcia|
|Cahill expects Arsenal title challenge|
|Jovetic happy with Inter debut|
|Luis Enrique: Barca defence must improve|
|Yanev calls for calm after ugly scenes in friendly|
|Coppa Italia Review: Cittadella romp to victory, Brescia rely on penalties|
|Arsenal have learned how to play against big teams - Ramsey|
|Shawcross to visit specialist over back woe|
|Fiorentina 2 Barcelona 1: Bernardeschi double sends Barca to another defeat|
|Mancini hints at Melo interest|
|Rodgers hails ´incredible´ Benteke strike|
|Galatasary 1 Inter 0: Sneijder sinks former club|
|Wenger defends Arsenal approach|
|Wembley loss has no bearing on new season - Terry|
|Porto cruise to friendly win over Stoke|
|Mourinho denies Wenger ´snub´ suggestions|
|Arsenal abandoned their philosophy to win Community Shield - Mourinho|
|Mourinho throws Community Shield medal into Wembley crowd|
|Swindon Town 1 Liverpool 2: Benteke nets stunner on debut|
|Scottish Premiership Review: Hearts win thriller on top-flight return|
|Ujah at the double as Bremen beat West Ham|
|Mourinho: We were the better team|
|Wenger hails defensive solidity|
|Rooney returns as Villarreal spoil Ferguson´s party|
|Rodriguez stunner earns Southampton draw as Caulker makes debut|
|Arsenal 1 Chelsea 0: Case of 14th time lucky for Wenger against Mourinho|
|Taechaubol announces Milan agreement|
|Jojic fires Cologne to latest victory|
|China 0 South Korea 2: Kim and Lee seal victory|
|Origi getting up to speed|
|Costa a doubt for start of season - Mourinho|
|North Korea 2 Japan 1: Halilhodzic´s men spurn lead|
|Allam brands FA ´amateurs´ as name-change row rumbles on|
|Fournier ´worried´ by Lyon pre-season|
|Swansea still working on Michu exit - Monk|
|Neuer furious at Bayern Supercup defeat|
|Wenger: Ozil signing not a mistake|
|UEFA Champions League Preview: Shakhtar ready for Fenerbahce decider|
|Lampard targets MLS play-offs for City|
|MLS Review: Goals galore as DC United win 10-goal thriller|
|Ronaldinho returns and helps Fluminense to win|
|Keane: United won´t overtake Chelsea|
|Casillas has the ´enthusiasm of a 20-year-old´ - Lopetegui|
|Blanc hopeful over Ibrahimovic knee injury|
|Guardiola laments late goal in Supercup defeat|
|Tuchel plans to keep Bender|
|Hecking happy with Wolfsburg discipline after Supercup win|
|Arsenal players too interested in selfies and six-packs - Keane|
|Confusion over Ibrahimovic´s PSG future|