In the same group, hard fighting Egypt finished bottom after a 2-1 loss to Saudi Arabia. However, veteran Egypt keeper El Hadary made history by becoming the oldest player to feature in the tournament aged 45 years and 161 days.
In pool B, Portugal progressed to the knockout stages with a 1-1 draw against Iran in a game full of VAR controversies. Veteran Ricardo Quaresma scored a first half before Karim Ansarifard tucked a late Iran spot kick into the top corner, as captain Cristiano Ronado's penalty was saved.
Spain finished top with another controversial two-all draw against Morocco.
Uruguay will play Portugal in the last 16 while Russia will tackle Spain.