Federer and partner Belinda Bencic beat Williams and partner Frances Tiafoe 4-2, 4-3(3) in the matchup between Switzerland and the United States at the Hopman Cup in Perth.
"I was nervous returning," Federer said in his on-court interview. "People talk about her serve so much and I see why it is such a wonderful serve because you just can't read it," Federer said. "It was great fun. You see how determined and focused she is, and I love that about her."
"GOAT vs. GOAT," Williams posted on Instagram, using the emojis for the acronym for Greatest of all-time. "The GOAT won."
The 37-year-olds each won their respective singles matches. Federer and Bencic earned a 2-1 win in the round-robin mixed doubles tie.
"It was a great experience," Williams said while alongside Federer. "I'm kinda sad it's over. I was just warming up."
Federer and Williams have combined for 43 Grand Slam singles titles.
The 2019 Australian Open is the next Grand Slam on the tennis slate. The tournament begins on Jan. 14 in Melbourne.