The seven-time champion suffered a shock 6-3, 6-7 (3/7), 4-6, 7-5, 6-3 defeat in a match where he crucially failed to convert break points in the fifth and ninth games of the fourth set.
The great Swiss, who won the last of his 17 majors at Wimbledon four years ago, looked heavy and flat-footed in the final set against a player who is nine years his junior.
He even stumbled and fell in the fifth set, lying face down in the turf of Centre Court where he has enjoyed his greatest moments.
"I was looking at Centre Court as in thank you for the crowd. That's what I was going through, not thinking about this might be my last Wimbledon."
Also Read
Had Federer made Sunday's final he would have been the oldest finalist since 39-year-old Ken Rosewall finished runner-up to Jimmy Connors in 1974.
His loss on Friday, in his 10th Wimbledon semi-final, followed a marathon five-set win from two sets down to beat Marin Cilic in the quarter-finals.
But Federer is enduring the toughest year of his career.
Injury forced him to skip the French Open ending a streak of 65 successive appearances at the Slams stretching back to 1999.
He has now failed to add to his 88 titles this year, his longest drought since 2000, and he arrived at Wimbledon having suffered back-to-back semi-final losses in Stuttgart and Halle, both on grass which has been his preferred surface of domination.
==============================
In an indication of changing times, his last-four loss in Stuttgart to Alexander Zverev was his first against a teenager in 10 years.