Winger Ismaila Sarr kept his cool to score a first half penalty and captain Kalidou Koulibaly netted a second goal as Senegal beat Ecuador 2-1 at the Khalifa International Stadium on Tuesday to earn a place in the last 16 of the World Cup.
Sarr scored his penalty in the 44th minute having earned the spot-kick himself, but Ecuador, who needed only a draw to reach the knockout rounds, equalised through Moises Caicedo.
That joy for the South Americans lasted only three minutes though as Koulibaly restored Senegal's lead, which they were able to hold onto for the remainder for the match.
The African champions finish second in Group A with six points from their three matches, one behind winners Netherlands and two ahead of Ecuador, whose tournament held much promise but has ended in bitter disappointment.
The beating of African drums was constant in the stadium as was the effort and endeavour of Senegal, who dominated the opening period against an opponent happy to sit back and try to soak up the pressure.
Idrissa Gana Gueye fired wide early and Senegal striker Boulaye Dia had a superb chance when he had a clear sight of goal, but skewed his shot wide of the far post.
The decisive moment in the half came late on when Sarr was ploughed into by Ecuador defender Piero Hincapie and picked himself up to convert the spot-kick, leaving goalkeeper Hernan Galindez rooted to the spot as the shot nestled in the bottom corner.
The flow of the game changed in the second period as it was Senegal who were happy to sit back and a desperate Ecuador pressed for the equaliser.
It arrived on midway through the half when Felix Torres flicked on a corner and Caicedo was unmarked as the back post to provide a simple finish. He is the first player other than Enner Valencia to score at the World Cup for Ecuador since Ivan Kaviedes in 2006.
The sizeable Ecuador support in the stands erupted in celebration, but that was halted shortly afterwards when Senegal struck again.
The South American side failed to clear a corner and the ball fell kindly for Koulibaly to volley into the net from six yards.