The world number two prevailed 7-6 (7/4) 6-4 in the ‘Match for Africa 2’ which was raising money for Federer’s charitable foundation.
There was just a single break of serve in the contest, Federer breaking for a 3-1 lead in the second set and serving out the match from there.
The 11,000 crowd in the Hallenstadion heard from the two players during a break in play after the first set, the pair being joined on court by the other members of Switzerland’s successful Davis Cup team and captain Severin Luthi.
They were also treated to traditional African song and dance during the changeovers.
The Roger Federer Foundation runs programs in six southern African countries, as well as Switzerland.
The match was the second such contest to raise cash for Federer’s project. The first saw Federer face Rafael Nadal at the same venue back in 2010.