It was a hard fought battle between the two decorated rivals who share 38 Grand Slam titles between them. It was their 40th career meeting.
Federer claimed a 7-6 (3), 1-6, 6-3, 6-4 victory.
Earlier, defending champion Djokovic beat Spanish outsider Roberto Bautista Agut in four sets in the other semifinal.
Djokovic won 6-2, 4-6, 6-3, 6-2 to script his 12th victory in his last 13 Grand Slam semifinals. The Serb is now one win away from a fifth title at the Wimbledon and 16th Grand Slam singles honour.