"When you get an opportunity you have to prove to the coach that you deserve to play."
But he was the hero against second-tier Sheffield after becoming the first player to score a hat-trick in an FA Cup semi-final since 1958, and the first player from City to bag a treble at Wembley Stadium.
"We compete with each other and motivate each other for the benefit of the team and in order to improve; we will see how the situation is in the next games," added Mahrez who has scored 15 goals in 38 games in all competitions with City this season.
Guardiola said Mahrez was always "grumpy" when he did not play.
"All the time, he makes me notice he's grumpy. Today, no. He's an exceptional player and his play was exceptional. A biggest-stage player who has the mentality to score goals," said Guardiola.
City, who are chasing a hat-trick of titles this season, will face either arch-rivals Manchester United or Brighton & Hove Albion in the FA Cup final on June 3.