will be ruled out of action for one month, his agent said.
The Swiss 17-time Grand Slam champion underwent the surgery to repair a torn meniscus sustained the day after his semi-final match at the Australian Open, according to Tony Godsick.
As a result of the surgery, Federer will now miss the ATP tournaments in Rotterdam and Dubai this month.
"I am so disappointed to have to miss Rotterdam and Dubai as they are two of my favourite tournaments on the ATP World Tour," Federer said.
"While this is an unfortunate setback, I feel grateful that up until now I have remained mostly healthy throughout my career. My doctors have assured me that the surgery was a success and with proper rehabilitation, I will be able to return to the Tour soon."The 34-year-old suffered a four-set defeat by eventual winner Novak Djokovic in the Australian Open semi-finals, going down 6-1, 6-2, 3-6, 6-3, in his eighth loss to the Serb in their past 10 Grand Slam meetings.
Federer has not beaten the runaway world number one at a major since the Wimbledon semi-finals in 2012, when he last won a Grand Slam title.
Unlike great rival Rafael Nadal, Federer has enjoyed a relatively injury-free career, the exception being bouts of recurring back pain.
The last time that happened was at the 2014 ATP World Tour Finals in London when he withdrew at the last minute from the final against Djokovic.
The following week, however, he returned to action and helped Switzerland win the Davis Cup for the first time, defeating France in the final.
After that the season switches to clay and the build-up for the French Open, the second of the year's Grand Slam tournaments. Federer's only title in Paris came in 2009.