PERTH, Australia — Roger Federer won the bragging rights over fellow tennis great Serena Williams as they faced each other on court for the first time on Tuesday, with Federer spearheading Switzerland’s 4-2, 4-3 (3) victory over the United States in a mixed doubles decider at the Hopman Cup.

“I was nervous returning. 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.”

Federer and playing partner Belinda Bencic overcame Williams and Frances Tiafoe in the Fast4 format as Switzerland beat the U.S. 2-1 in front of a 14,000 capacity crowd.

Federer and Williams shared a good-natured interview afterward and then engaged in a selfie.

“It was so fun. This is super cool that we get to do it at such a pinnacle point of our careers,” Williams said. “I was so excited, and literally it was the match of my career. Just playing someone so great, and someone you admire so much, and a match that actually means something.”

Federer and Williams have won 43 Grand Slam singles titles between them.

Defending champion Switzerland will qualify for Saturday’s final if it beats Greece on Thursday. The United States, which lost to Greece on Monday, can’t now advance.

The much-hyped contest quickly lived up to its billing with Federer almost running down Williams’ smash into the open court. Williams and Federer served strongly and were unable to return any of each other’s serves in the first set.

Federer’s sublime touch at the net proved decisive as he moved closer to a record third Hopman Cup title.

Williams grabbed at her right shoulder on several occasions late in the second set but played down any injury concern.

“It was such a quick turnaround, I didn’t have enough time to reload the cannon. It’s totally normal,” she said.

Earlier, Federer beat Tiafoe 6-4, 6-1 in the men’s singles before Williams leveled the tie with a comeback 4-6, 6-4, 6-3 victory over Bencic.