The ceremony is scheduled to take place Saturday, July 9, the team announced Tuesday.
Hernandez, who has been with the franchise for almost three decades as a player and broadcaster, ranks second in team history in batting average (.297) and had a franchise-record six Gold Glove awards.
"I'm thrilled," Hernandez said in a statement. "This is truly a special honor that lasts beyond a lifetime. ... I was very emotional when [owner] Steve [Cohen] called to let me know about the number retirement. This is the highest honor an organization can bestow upon a player. I also want to thank Mets fans, who have treated me like family since I arrived in 1983."
Hernandez will join Tom Seaver (41), Mike Piazza (31) and Jerry Koosman (36) as the only players to have had their numbers retired. The Mets also have retired numbers for managers Gil Hodges (14) and Casey Stengel (37).
"Keith was the first captain in team history and a great leader and catalyst on that '86 championship team," Cohen said in a statement. "He was a defensive wizard at first and was a clutch performer late in games. We made a promise to continue celebrating and honoring our tremendous history and this is another deserving step in that direction."
The five-time All-Star had a .310 batting average with 34 doubles, 13 home runs and 83 RBIs, and led the National League with 94 walks during the Mets' run to the World Series crown in 1986.
He has served as a broadcaster for the team since 1999.