Mixed doubles matches rarely create headlines, but when they involve Serena Williams playing Roger Federer — you better believe they do. The tennis titans squared off for the first time in their legendary careers Tuesday, with Williams subsequently describing Federer as “the greatest of all time.”

A lot of fans, and not just in the tennis world, would apply the same term to the 37-year-old Williams, whose 23 Grand Slam singles titles are the most in the Open era for a man or a woman. Federer, also 37, holds the men’s record with 20 titles, and he was equally complimentary of Williams after his Switzerland team beat her U.S. squad at the Hopman Cup in Perth, Australia.

After Williams and Federer won their singles matches in the round-robin tournament, they faced each other in a deciding mixed doubles match. Federer, playing with Belinda Bencic, got past Williams and Frances Tiafoe, 4-2, 4-3 (7-3), in a format aimed at shortening matches

“It was a great experience. I’m kind of sad it’s over — I was just warming up!” Williams said afterward. “Honestly, it was so fun.

“We grew up together, and so having an opportunity after all of these years to play each other — we’ve actually never done this,” she continued. “It’s super cool that we actually get to do this, at this pinnacle of both of our careers.”

Asked in an on-court interview about what “stood out” to Williams while facing Federer, she replied: “Well, the guy is great. He’s the greatest of all time, to be honest."

”Both on and off the court, he has such charisma; he’s such a wonderful player,” Williams continued. In an effort to “narrow it down” to a specific comment on Federer’s game, Williams said: “I don’t know if this is the right thing to say, but I think his serve is super underestimated. He has a killer serve. . . . There’s a reason why he’s the greatest, because you can’t be that great and not have such an awesome weapon like that serve.

"Maybe I could get some tips from him later on,” Williams added to laughs from the capacity crowd of 14,000.

For his part, Federer said he was “nervous” about the prospect of having to get a racket on Williams’s offerings. “People talk about her serve so much, and I see why — it is such a wonderful serve, because you just can’t read it,” he said.

“It was great fun,” Federer added of the match. “You see how determined and focused she is, and I love that about her.”

“I’ve been looking forward to it since I saw it,” Williams said before the match. “I was like, ‘Oh, my God, this is so cool.’ So it’s just something that, as a player, is something that you would dream of: to play Roger Federer.”

After the interview, it was time for a superstar selfie and a hug. Federer posted the photo to social media, with the caption, “Oh what a night.”

In the preceding singles matches, Williams beat Bencic, 4-6, 6-4, 6-3, and Federer had an easier time with Tiafoe while winning, 6-4, 6-1. The loss to Switzerland ended the chances for the United States to advance to the Hopman Cup final; Federer and Bencic can reach it by defeating Greece’s Stefanos Tsitsipas and Maria Sakkari on Thursday.

Read more from The Post: