Federer won 7-6, 1-6, 6-3, 6-4 to reach the final round.
Their meeting was the 40th match between the rivals, but only the fourth at Wimbledon. They were playing each other at the tournament for the first time since their classic final match in 2008.
Federer will play Novak Djokovic in the finals Sunday at 9 a.m. EDT. The championship match will air on ESPN.
Federer last won Wimbledon in 2017. He also won the event every year from 2003 to 2007 as well as 2009 and 2013.