The City midfielder and Algerian skipper was a calming influence in what was a fractious Group C clash with Youcef Belaili’s 49th minute strike ultimately proving the difference.
The encounter at the Egyptian capital's 30 June Stadium had been billed as a meeting of two of the continents’ leading nations with each having won their opening group game.
Instead, it proved to be an ill-tempered affair, especially in a first 45 minutes with precious little flow to the game as both sides’ attacking endeavours were interrupted by niggly fouls.
The Desert Foxes upped the intensity and tempo immediately after the break and, straight after the best move of the game saw Sofiane Feghouli fire just wide on 47 minutes, Algeria broke the deadlock.
Feghouli was the provider cutting the ball into the box from the right flank and Belaili showed vision and composure to fire home a low shot through a mass of Senegalese bodies into the net.
A piece of Mahrez brilliance on 71 minutes almost doubled the Algerians lead. The City ghosted his way through several defenders before unleashing a dipping shot which was inches wide.
But Senegal were then denied what looked a rock-solid appeal for a penalty after Liverpool’s Sadio Mane was sandwiched by Adlene Guedioura and Ramy Bensebaini.
However, it was Algeria who prevailed to make it two wins out of two and Mahrez and Co now wrap up their Group C campaign against Tanzania on Monday.