Algeria knocked Senegal out of their stride and kept Sadio Mane under wraps as they edged the West Africans 1-0 in a stop-start Africa Cup of Nations match on Thursday to reach the last 16.
Forward Youcef Belaili rifled home the only goal in the 48th minute of a match featuring a remarkable 52 fouls according to official statistics, 34 by Algeria, to leave the Desert Foxes top of Group C with six points from two games.
Senegal felt they should have had a penalty midway through the second half when two players barged into Mane but the referee was not interested, another sign that officiating is different in the tournament compared to other regions.
"Tactically, it was a very interesting match. You can't give them the smallest of spaces otherwise you will play dearly," said Algeria coach Djamel Belmadi. "The players deserved it -- they followed my advice very closely."
Senegal made a lively start and Mane, on the end of crunching tackles throughout the match, wasted a free kick by firing high over the bar, the first indication it was not to be his evening.
Another foul on Mane led to a scuffle but, apart from that, the game never got out of control despite the tension bubbling under the surface.
At the other end, Baghdad Bounedjah was a constant menace to Senegal and nearly gave Algeria the lead when he lobbed the ball over Edouard Mendy as the goalkeeper came racing off his line only for Kalidou Koulibaly to clear the danger.
Bounedjah also charged down a Mendy clearance after the goalkeeper dallied but the ball rebounded into touch and he had another effort tipped round the post.
Algeria broke through four minutes after halftime when Belaili's strike evaded two defenders to leave Mendy unsighted after Senegal lost the ball in midfield.
Senegal looked uncomfortable having to chase the game and nearly went further behind when Algeria captain Riyad Mahrez ended a twisting run by firing narrowly wide.
Their best chance fell to Mbaye Diagne after goalkeeper Rais Mbolhi parried a fierce Alfred Ndiaye shot but he sent his close-range header wide.
"It is difficult to say what went wrong," said Senegal coach Aliou Cisse, whose side have three points and face Kenya in their final game. "It was an even match but it was the small details that counted.
"A few things didn't go right but I continue to have confidence in my team and my players. The next match will be decisive. We will have to prove that we are a good team."