The little-known head of the Madagascar FA managed to gather 14 more votes than Hayatou, who has been president since 1988. The 70-year-old has been in power for close to three decades.
Hayatou was seeking an eighth four-year team having been re-elected unopposed four years ago.
Ahmad received 34 votes, while Hayatou only managed 20. The latter holds a seat as world football governing body senior vice-president.
Download our app and read this and other great stories on the move. Available for Android and iOS.