El-Hadary, whose last appearance for the Egyptian team was his 153th cap in a 2-1 group stage defeat by Saudi Arabia, with Egypt crashed out of the tournament with three losses.
The goal-stopper for the North African team broke the record of Faryd Mondragon of Colombia, who played the last five minutes of a group game in Brazil four years ago, at the age of 43 years and three days.
“After 22 years, four months and 12 days, I saw it as the best moment to hang up my gloves,” El-Hadary said in a Facebook post on Tuesday.
“I’m proud to have played with the national team in 159 internationals, participating in unprecedented achievements.
“I hope I have succeeded in my mission over the past years.
“I extend my thanks and gratitude to my family, who have borne the difficulties of my life and supported me in all my steps.”