What you need to know:
- Goals either side of half-time from Boulaye Dia and Famara Diedhiou gave Senegal the lead before Qatar substitute Mohammed Muntari replied in the 78th minute to set up a dramatic finale
- Mendy was rooted to his line when Muntari pulled one back for Qatar, powerfully heading home Mohamad's cross to haul the hosts back into it.
Host nation Qatar were pushed to the brink of an early elimination from their own World Cup on Friday after a 3-1 defeat to Senegal.
Goals either side of half-time from Boulaye Dia and Famara Diedhiou gave Senegal the lead before Qatar substitute Mohammed Muntari replied in the 78th minute to set up a dramatic finale.
Senegal substitute Bamba Dieng scored six minutes later to put the result beyond doubt and lift the African champions, who opened with a 2-0 loss to the Netherlands, right back into contention in Group A.
The defeat left bottom side Qatar sweating on results elsewhere if they are to avoid following South Africa in 2010 as only the second World Cup hosts to bow out after the first round.
Their elimination would be confirmed if Ecuador fail to beat the Netherlands later in the day, and would make Qatar the first World Cup hosts to go out after two games.
Qatar had made a nervy start to the tournament in a 2-0 defeat to Ecuador and they again looked tentative against Senegal.
The Asian champions dropped their goalkeeper Saad Al Sheeb to the bench after his shaky performance in the opener.
His replacement Meshaal Barsham did not inspire much confidence in the early stages, flapping at a corner as Senegal pushed for the opening goal.
Ismaila Sarr and Nampalys Mendy had already missed scoring chances for Senegal by then, and Idrissa Gana Gueye and Youssouf Sabaly squandered more as the first half wore on.
Qatar almost out
Qatar spent most of the opening 45 minutes on the back foot but a rare break forward saw Akram Afif incensed not to be awarded a penalty after he was bundled over by Sarr.
Senegal looked like they would head into half-time without managing to break down Qatar's resistance, only for the hosts to gift them a goal in the 41st minute.
Qatari defender Boualem Koukhi fluffed a clearance to leave Dia to pounce on the loose ball and fire it past Barsham.
Senegal doubled their lead almost immediately after the break when Diedhiou glanced home a header at the near post from a corner.
Qatar began to show much more attacking ambition from two goals down and Afif was involved in everything.
Almoez Ali forced a fingertip save out of Senegal goalkeeper Eduoard Mendy before the Chelsea man again rescued the Africans from Isamil Mohamad's effort.
Mendy was rooted to his line when Muntari pulled one back for Qatar, powerfully heading home Mohamad's cross to haul the hosts back into it.
The goal lifted the crowd and sent Qatar surging forward in search of another, but Dieng nipped the revival in the bud in the 84th minute when he swept the ball home for Senegal's third.
Abdelkarim Hassan then lashed a free-kick just wide of the post as Qatar tried to hit back but Senegal held firm to see out the win.