When Federer closed out the victory with service winner, he
threw up his arms and began hopping, then hugged his partner.
The medal is the first in three Olympics for Federer, who has
won 12 Grand Slam singles titles.
But he's now a medalist for the first time in his three Olympics.
"Sort of a dream-come-true moment," Federer said. "Maybe it comes around once in a lifetime. It's almost disbelief, to some degree."
Federer will also try to stress the positive after failing to snap his singles slump in Beijing, setting his sights on the U.S. Open beginning Aug. 25. He has won that title the past four years but will be seeded No. 2 at a major event for the first time since January 2004, behind Nadal.
"Rafa played great to get it," Federer said. "That's what I expected and hoped for many years ago when I got to No. 1 -- that if ever somebody were to take it away from me, he would have to play an incredible tennis schedule, win the biggest tournaments, dominate the game basically. I think Rafa totally deserves it."
Not that Federer's washed up, as he showed with some brilliant shotmaking in the doubles final, especially at the net.
Serving for a gold medal brought out the best in him. At 5-3 in the final set, he hit a service winner on the first point, then a reflex volley for a winner and another service winner. On championship point he curled in a second serve that Johansson couldn't handle, and the Swiss were gold medalists.
"It's not the first time this tournament or in my life I had to serve for a big match," Federer said. "It's basically the moment you dream of being in, even though there is so much pressure to it."
In men's singles, Novak Djokovic claimed the bronze medal for Serbia on Saturday by beating Blake 6-3, 7-6 (4).
When he closed out the tiebreaker, a jubilant Djokovic ripped off his shirt and threw it to the cheering crowd, along with two rackets, and he started to throw his bag before stopping. He took a Serbian flag from a fan and waved it as he jogged around the court.
Djokovic, seeded third, bounced back from a three-set loss to Nadal in the semifinals Friday.
"To win any medal in the Olympics is a huge achievement," Djokovic said. "Not many of the athletes get a chance to win a medal."
Blake lost back-to-back matches after upsetting Federer and failed to medal.
"I felt like I competed hard," Blake said. "I have to take something positive from the way I was playing this week."
The Olympic medal is the first for the Bryans, who have won all four Grand Slam championships and 48 tournament titles. They were seeded No. 1 in Beijing but lost to Federer and Wawrinka in the semifinals Friday.
"We're leaving China on a high," Mike Bryan said. "We were obviously disappointed that we couldn't make the gold-medal match, but it's going to be something really special to us to have that medal back at home."
Llodra and Clement were coming off a 19-17 third-set loss in the semifinals.