Morocco drew 2-2 with Gabon in Yaounde in one of the games of the Africa Cup of Nations so far as both sides progressed from Group C.
The Atlas Lions fell behind in the first half as Gabon’s Jim Allevinah slid past the onrushing keeper.
Morocco’s equaliser from the penalty spot by Sofiane Boufal after 74 minutes sparked a thrilling finale.
First, Gabon forced Nayef Aguerd into scoring an own goal before Achraf Hakimi curled home a free-kick.
Morocco will stay in the Cameroonian capital for their next game, against the best third-placed side from either Group A, B or F, on 25 January.
Gabon, meanwhile, will face Burkina Faso in Limbe as both sides kick off the Round of 16 on Sunday 23 January.
Gabon impress in Yaounde
Having exited in the group stage as hosts in 2017 and missed the 2019 finals altogether, Gabon were hugely impressive when reaching the knock-out stage for only the second time in the past 25 years.
They took the game to a Moroccan side who rested six players from the team that secured qualification for the knock-outs when beating Comoros 2-0 last time out.
Chance upon chance came their way with Aaron Boupendza, who was lively throughout, toe-poking wide just after the half-hour when it looked easier to hit the target.
Seven minutes before the break, Guelor Kanga hit a blistering free-kick from 40 yards that forced reserve keeper Monir El Kajoui to tip over the bar – just as he had to from the resulting corner when denying Lloyd Palun’s firm header with a fine stop.
Despite missing Pierre-Emerick Aubameyang, who had to take to social media to deny reports he had been out drinking prior to being sent back to England for checks on heart lesions seemingly developed after a Covid infection, Gabon continued to threaten.
Allevinah almost scored one of the goals of any Nations Cup when meeting a deep cross from a tight angle to fire against the bar with a strike that brought back memories of Marco van Basten’s stunning 1988 European Championship final goal.
Morocco stir to clinch top spot
Morocco had enjoyed the greater possession in the first half without forcing a shot on target, but this changed as a worried-looking Atlas Lions coach Vahid Halilhodzic rang the changes.
The increased threat brought a penalty converted by Boufal after he had won the spot-kick, even if it seemed that Andre Biyogo Poko had won the ball.
After video assistant referee Janny Sikazwe, who was back after reported heatstroke during his calamitous display when blowing for full-time early in the Tunisia-Mali game, failed to question the decision, Morocco were back in the game.
Seconds later, Boupendza flashed a strike past the post before he then ran off in wild celebration to the hordes of Gabonese fans, jumping the advertising boards as he did so, after he pressured Aguerd into turning home Allevinah’s smart cut-back nine minutes from time.
Gabon were top of Group C for the second time on the night only for Biyogo Poko to concede another set-piece, which Paris Saint-Germain star Hakimi converted with a mesmeric free-kick that left Gabon’s goalkeeper grasping thin air.
It was a fitting end to a thrilling game as Group C delivered goals aplenty to a Nations Cup criticised for a lack of them, and ensured that Morocco – looking to reach the final for the first time since finishing runners-up in 2004 – proceed into the same half of the draw as hosts Cameroon.