Benin produced a major surprise to beat Morocco 4-1 on penalties and book a quarter-final spot at the Africa Cup of Nations for the first time.
Mama Seibou hit the winning penalty to send 10-man Benin through after Khaled Adenon had been sent off in extra time.
Youssef En-Nesyri’s equaliser 14 minutes from time got Morocco back into the game after Moise Adilehou’s shock opener and it seemed like they would go through when Benin skipper Stephane Sessegnon felled Achraf Hakimi in the box.
Ziyech sent the goalkeeper the wrong way but saw his effort come agonisingly hit the outside of the post.
Benin played 23 minutes of extra time down to ten men after Khaled Adenon was dismissed for apparently shoving the referee, a second bookable offence.
He left the pitch very reluctantly before engaging in an argument with the Moroccan bench and it remains to be seen if he will play again in the tournament.
The underdogs looked to have been looking to get to penalties from the first minute and their accomplished kicks suggested as much.
In contrast Morocco appeared nervy in the shoot-out with Sofiane Boufal blazing over the bar and Youssef En-Nesyri seeing his kick saved.