Khalil was instrumental in the game's opening goal in the 33rd minute. Picking up the ball on the right flank, he powered past Roy Smith and squared the ball across the six-yard box, where Ahmed Ali got ahead of David Guzman and put the ball past Esteban Alvarado.

However, four minutes later, Costa Rica were level. UAE were given a warning earlier in the half when Smith rose unmarked, but they didn't learn their lesson quickly enough. Oviedo put in the perfect cross from the left and Josue Martinez jumped well before powering a textbook header into the top corner, leaving Abdulrahman with no chance.

Chances dried up after the interval. Sultan Al Menhali delayed a shot when well placed which allowed the Costa Rican defence to clear. Then, at the other end, Cristian Gamboa slipped the ball to Marcos Urena, who fired across the face of goal.

UAE's attacking potency was dealt a blow when Ahmed Ali limped off after 67 minutes, and his replacement, Ali Mabkhoot missed a glorious chance which would have surely sealed a win in normal time for his side. With three minutes remaining, he capitalised on a slip from Jose Mena and found himself with the keeper to beat.

From an acute angle, but with a considerable gap to aim at, the Al Jazira forward fired into the side netting and that was the last chance of the game. Extra time beckoned and the crowd in Cairo did not have too long to wait to see UAE go close once again. It was Khalil who almost put his side in front when he powered in a right footed shot which was inches away from hitting the target.

In the second period of extra time, Khalil and Hamdan Al Kamali stung the palms of Alvarado with shots from outside the box and both Mabkhoot and Al Kamali went close with long-range efforts. With two minutes to go, Mohamed Fawzi was shown a straight red card for a two-footed lunge and, with the brief numerical advantage, Costa Rica took advantage.

A long free-kick from the left back position was pumped into the box and Al Kamali tried to head it back to the keeper, without noticing Allen Guevara bearing down on goal. His first-time effort was well saved by Abdulrahman, but parried into the path of Marcos Urena, whose shot sailed into the back of the net.

It means a semi-final repeat of the Group E clash between Brazil and Costa Rica, which A Seleção won 5-0 in Port Said.