Ismaeil Matar sent Mahdi Redha's team into a surprise lead in the first half but the Maccabi Tel Aviv striker struck again to secure a draw, with a tie against Mexico now loomingMoussa Konate scored his fourth goal of the Olympic Games to rescue a 1-1 draw for Senegal against the United Arab Emirates and set up a meeting with Mexico in the quarter-final.
Konate's header shortly after half-time ensured that Senegal finished the group stage on five points, with Uruguay's defeat against Great Britain meaning that they would have been sent through to the next round regardless of the result at the City of Coventry Stadium.
Ismaeil Matar opened the scoring against the run of play in the first half with a delicate chip but Mahdi Redha's team could not hold out for their first win at the Games meaning the UAE finish the tournament bottom of Group A with two points having also drawn with Uruguay.
Konate was selected to lead the line for Senegal, with Magaye Gueye joining the attack on the left flank as Pape Souare reverted to left-back. Kara Mbodji replaced the suspended Abdoulaye Ba.
The UAE, meanwhile, replaced Abdulaziz Hussain with Mohamed Fawzi at right-back, while Khalid Eisa came in for Ali Khaseif in goal.
After a muted start, Konate found some space for the first time on the left-hand side. The striker skipped past Fawzi's challenge and fired a tantalising cross into the six-yard box but Hamdan Al Kamali did well to clear with his head.
Souare showed off his potent left boot by first curling in a low cross that just evaded Konate at the back post before delivering a similarly dangerous ball that Cheikhou Kouyate could only head wide after a flick-on by Papa Gueye.
Just as the African side seemed to be cranking up the pressure, the UAE advanced up the pitch and stunned their opponents by opening the scoring.
Rashed Eisa got away from right-back Zargo Toure on the left and drove into the box before cutting back and sliding a pass into the path of Matar. The captain kept his cool despite the onrushing presence of Ousmane Mane, gently dinking the ball over the goalkeeper to give his country the lead.
Senegal remained well on top but still the breakthrough eluded them. Konate was again denied a tap-in when Al Kamali intercepted a low cross from the right, while Toure, who, like Souare, adventured forward from full-back whenever the opportunity presented itself, had a goal-bound shot blocked.
Stephane Badji's powerful effort from 25 yards took a deflection and required a good save from Khalid Eisa as the UAE preserved their lead until half-time.
Abdoukarime Diouf introduced Ibrahima Balde at the break, with Magaye Gueye making way and Konate subsequently shifting to the right flank.
The change paid off immediately. Souare, turning in a fine display at full-back, received a pass in space high up the field and ignored Balde's run to the near post to pick out the entirely unmarked Konate, who made no mistake with his header from six yards.
Senegal promptly set about adding a second, and came agonisingly close three times in quick succession. Ismaeel made a vital interception to stop Konate converting Sadio Mane's cross before the Maccabi Tel Aviv striker was played in by Balde but denied by Khalid Eisa.
Badji tried his luck once more from range and seemed to surprise the goalkeeper, who was late in dropping to his left to keep the shot out but did so in the nick of time.
As they sensed that their opponents might be there for the taking, though, Senegal lost all patience in their build-up play and were guilty of attempting too many difficult through balls, slowing down their momentum. Chances for the UAE remained few and far between, however, with Omar Abdulrahman thumping one shot well over.
Two headers that missed the target aside, Senegal grew increasingly frustrated in their efforts to carve out a winning goal as the match wore on. Matar could have added a second after good play from substitutes Ismail Al Hammadi and Ali Mabkhoot but failed to keep his shot from the edge of the box down.
Souare's crosses from the left had been sublime but Toure provided arguably the best delivery of the match after 69 minutes, only to see both Balde and Konate fail to make a connection.
The UAE desperately appealed for a penalty when Omar Abdulrahman dodged Cheikhou Kouyate's foul around the edge of the penalty area before going over when challenged by Mbodji, but referee Svein Oddvar Moen elected to book the Al Ain midfielder for diving when it appeared contact had been made.
Mbodji had time to hit the post from a Souare corner before Senegal turned to the 6' 5" frame of Kalidou Yero in the closing stages.
Redha's team clung on for a second point, though, with Matar's selfless performance in attack earning loud applause upon his substitution for Habib Fardan late on.