Also selected were Martina Hingis, Stan Wawrinka, Belinda Bencic, Timea Bacsinszky and doubles specialist Xenia Knoll, whose place is dependent on International Tennis Federation approval.
Federer, a 17-time Grand Slam singles champion without an Olympic singles title, has long been expected to play singles and mixed doubles with Hingis in Rio.
The Swiss federation selecting Federer for men’s doubles, too, leaves open the possibility that he and Wawrinka could pair together for a third straight Games. They won gold at Beijing 2008 and were upset in the second round at London 2012.
However, Federer did not play mixed doubles when it returned to the Olympic program in 2012. Federer has expressed doubt that he could play all three of singles, doubles and mixed doubles at the Olympics, given the crowded schedule.
Hingis, 35, returns to the Games for the first time since her Olympic debut in 1996. As expected, she is listed in doubles and mixed doubles but not singles.