Mohamed Salah scored a first-half penalty as 10-man Egypt beat South Africa 1-0 in their Africa Cup of Nations Group B clash in Agadir, booking their place in the knockout phase in the process.
Salah won the penalty when he was clipped in the face by South Africa defender Khuliso Mudau as they tussled for the ball in the box, and stepped up to easily convert for his second goal of the tournament.
It was the Liverpool striker's 65th goal overall for his country.
Egypt lost right-back Mohamed Hany to a red card for an ugly stamp at the end of the first half and faced wave after wave of South African attacks in the second period, as the latter were denied a penalty of their own for handball following a lengthy VAR check.
With a man advantage, South Africa had 17 shots in the second half alone, though many of them were speculative and wayward.
Mudau's shot forced a good save from El Shenawy as South Africa camped in their opponents’ half to try to force an equaliser.
Lyle Foster’s flick into the path of Aubrey Modiba created another opportunity from eight yards, but El Shenawy saved again and South Africa were left to ponder a frustrating defeat and their first competitive loss under coach Hugo Broos in almost two years.
The result leaves Egypt top on six points, with South Africa still in second on three points with a game agaisnt Zimbabwe to come.
Zimbabwe and Angola have one point apiece after drawing 1-1 earlier on Friday, though the result leaves both facing the possibility of early elimination.
They both lost their opening Group B clashes and are now left with difficult assignments in their last matches next week which they will effectively need to win if they are to progress.
Angola went ahead in the 24th minute when To Carneiro's chipped pass fell perfectly for striker Gelson Dala, who ran onto it and squeezed the ball in at the near post as Zimbabwe’s defence proved too slow in closing down.
Zimbabwe’s veteran striker Knowledge Musona equalised with the last kick of the first half.
Comoros played out a goalless draw with Zambia in Group A but the small Indian Ocean island nation came close to an upset win.
Comoros had the ball in the net in the 19th minute, but Myziane Maolida's attempt was ruled out after a VAR review for a foul in the build-up to the goal.
Maolida had tapped in the ball from close range after a mazy run down the left flank by Rafik Saifi, who played in a pinpoint cross.
But possession was won in a dangerous tackle by Yacine Bourhane on Owen Tembo, and after consulting the sideline VAR screen, the referee disallowed the goal.
Comoros also had a late chance when Faiz Selemani headed over the top of the Zambia goal after being set up by captain Youssouf M'Changama's hanging chip.
Zambia, the 2012 winners, put up a laboured showing.
The draw at Stade Mohammed V left Comoros, the smallest nation in the tournament's 24-team field, with a single point from their opening two matches, after they were beaten by hosts Morocco in last Sunday's opening match. Zambia have now drawn both their opening fixtures.
Both countries will have a tough last group match on Monday, which, if they lose, will almost certainly see them eliminated.
Comoros must beat Mali in Casablanca on Monday to stand any chance of progress, while Zambia are up against Morocco and in need of at least a draw.