He also tumbled out of the French Open to Robin Soderling at the quarter-final stage.
Federer had not lost before the final at SW19 since 2002 and was bidding to win a record-equalling seventh title.
After his Wimbledon exit, the 28-year-old said he was struggling with back and thigh problems picked up at a pre-Wimbledon grass-court event in Halle, Germany.
He said he was looking forward to a rest, but would be ready to "attack again" at the US Open at the end of August.
Bookmark with:
What are these?