Standing in his way will be Britain's Andy Murray, who fell victim to Federer last month when they met for the Wimbledon title.
Federer reached the gold medal match by defeating Juan Martin del Potro of Argentina 3-6, 7-6 (7-5), 19-17 on Centre Court. The match lasted 4 hours, 25 minutes.
With Federer serving at 11-12 in the third set, del Potro won the first two points of the game. Federer, however, ran off the next four points to stay alive and finally prevailed in an epic contest that set up a rematch with Murray.
Murray earned his way into the finals with a riveting 7-5, 7-5 victory over Novak Djokovic.
The women's championship match will be between Maria Sharapova of Russia and American Serena Williams, who has played overwhelming tennis during the Olympics just as she did during her recent triumph at Wimbledon.
Sharapova defeated countrywoman Maria Kirilenko in the semifinals 6-2, 6-3. Williams crushed No. 1 seed Victoria Azarenka of Belarus 6-2, 6-1.
Not only has Williams failed to drop a set during her five Olympic matches, she has allowed her opponents no more than three games in any set.
Mike and Bob Bryan of the United States also earned a spot in the doubles championship match with a 6-4, 6-4 decision over Julien Benneteau and Richard Gasquet of France. The Bryans will take on Michael Llodra and Jo-Wilfried Tsonga, also of France, for the gold medal.
Federer, who won the doubles gold medal with Stanislas Wawrinka in Beijing, lost in the second round of the singles tournament at the 2004 Olympics and fell in the quarterfinals to American James Blake four years ago.
Federer made 41 unforced errors to 34 for del Potro Friday but served 24 aces to 11 for his opponent and produced 64 total winners to 51 for the Argentine.