"It has been a long time coming," he said.
The wait included an Olympic marathon Friday, when Federer played for 4 hours, 26 minutes to beat Juan Martin del Potro of Argentina 3-6, 7-6 (5), 19-17. It was the longest three-set men's match of the Open era.
"I definitely got a sense that it was something special," the top-seeded Federer said. "The deeper we went into the match, the more I thought, 'Wow, this is so cool to be part of a match like this.'"
Federer converted only two of 13 break-point chances, the second coming in the next-to-last game, and had several nervous moments. But he held serve 12 times in the final set to stay in the match.
With the comeback victory, the four-time Olympian is assured of at least a silver. On Sunday he'll play in the final against No. 3 Andy Murray of Britain, who beat No. 2 Novak Djokovic of Serbia 7-5, 7-5.
In 2008, Federer and Swiss teammate Stanislas Wawrinka won the gold in doubles. But Federer had been 0 for 3 in Olympic singles, the biggest blemish on a resume that includes a record 17 Grand Slam titles.
His latest title came at Wimbledon a month ago against Murray, who relishes the shot at a rematch on the same court.
"I hope it's a great match," Murray said, "because the way the matches went today, I think the tournament deserves a great final. I hope we can provide that."
Serena Williams also clinched her first Olympic singles medal, beating No. 1-seeded Victoria Azarenka 6-1, 6-2. On Saturday, the No. 4-seeded Williams will face first-time Olympian Maria Sharapova, who beat Russian teammate Maria Kirilenko 6-2, 6-3.
Williams teamed with sister Venus to win the gold in doubles in 2000 and 2008. They have a chance to clinch at least a silver in the semifinals Saturday.
Americans Bob and Mike Bryan are assured of at least a silver after beating Julien Benneteau and Richard Gasquet of France 6-4, 6-4 in the semifinals of men's doubles. Mike Bryan and Lisa Raymond advanced to the first Olympics mixed doubles final since 1924 by beating Del Potro and Gisela Dulko 6-2, 7-5.
For duration, Federer's latest victory didn't rival John Isner's 70-68 final-set win at Wimbledon in 2010, or even Jo-Wilfried Tsonga's 25-23 win in the third set at the Olympics this week. But the match offered epic drama magnified by the setting and the stakes for Federer.
He improved to 12-0 this summer at the All England Club, including a record-tying seventh Wimbledon title a month ago.
There were no match points until the final game. After a couple of wobbly moments by Federer, including a double-fault, he sealed the victory when Del Potro dumped a backhand in the net.
Federer lifted his arms in jubilation, then leaned wearily on the net while awaiting congratulations from the big Argentine. They shared a warm embrace.
"I felt for him in a big way," Federer said, "because I've been there as well."
Said Del Potro: "It's not an easy situation. Someone always has to win these matches, and today it was his turn."
Del Potro will play Djokovic for the bronze Sunday.
The 1.98-meter-tall (6-foot-6) Argentine had the edge on Federer for most of the first two sets, reaching the net more often and winning the majority of the baseline rallies, starting with a 23-shot exchange in the opening game. Del Potro showed little apparent effort as he snapped explosive forehands that had Federer scrambling and lunging.
"Not enough, Roger!" a British spectator shouted when Federer fell behind.
The near-capacity crowd on sunny Centre Court was clearly in Federer's corner. Fans clapped and chanted "Ro-ger!" during a changeover, and later "Let's go, Roger!" More than once a Swiss cowbell clanged.
Small clusters of Argentine fans broke into song, and the match — like the entire tournament — took on an atmosphere more festive than during Wimbledon.
Federer's comeback came slowly. He was on the verge of digging a deeper hole midway through the second set, when he faced a break point and needed 16 points to hold for a 3-2 lead. He played another patchy game at 4-all, when he misplayed an overhead, blew an easy volley, squandered a 40-love lead and faced another break point.
He managed to hold again, and never trailed in the tiebreaker. Then the match proceeded on even terms for the next couple of hours.
In the 15th game of the final set, Del Potro twice won rallies after clipping the net cord with shots, the second time to erase a break point. Federer's bad luck had him screaming in frustration.
But for the most part, he managed to keep any annoyance in check. In the 31st game of the final set, when he mishit back-to-back forehands — the second sailed long — he gave his wife a wry grin.
"I was very tense at certain times," Federer said. "I was seeing myself as a loser many times during the match. But at the same time also I did see myself with medals. So you go through many emotions."
Federer broke for the first time in the 19th game of the final set when Del Potro double-faulted twice. That gave Federer a chance to serve for the victory at 10-9, but he was broken at love.
He waited 16 games for another chance, while repeatedly holding easily. Del Potro made three unforced errors in the 35th game to lose serve for only the second time, and eight points later the marathon reached the finish line.