Serena Williams has paid an emotional tribute to Roger Federer following the Swiss star's retirement announcement.

The two tennis legends both decided to hang up their racquets this month, marking the end of a huge era within the sport.

Between them, they won 43 Grand Slam singles titles and graced the courts for more than two decades.

The duo also faced each other in an historic mixed doubles match in Australia back in 2019, with Federer and partner Belinda Bencic beating Williams and Frances Tiafoe.

What did Williams say to Federer?

Williams took to Instagram to post a heartwarming photo of her and Federer taking a selfie together during the famous mixed doubles match three years ago.

"I wanted to find the perfect way to say this, as you so eloquently put this game to rest — perfectly done, just like your career," Williams captioned her touching post.

Serena Williams and Roger Federer at the 2019 Hopman Cup

PERTH, AUSTRALIA - JANUARY 01: Serena Williams of the United States and Roger Federer of Switzerland take a selfie following their mixed doubles match during day four of the 2019 Hopman Cup at RAC Arena on January 01, 2019 in Perth, Australia. (Photo by Paul Kane/Getty Images)

"I have always looked up to you and admired you. Our paths were always so similar, so much the same. You inspired countless millions and millions of people — including me — and we will never forget.

"I applaud you and look forward to all that you do in the future. Welcome to the retirement club. And thank you for being you."

Williams also shared the post to her Instagram story, alongside another touching message.

"Thank you for all you've contributed to the sport and beyond. I will miss your face on tour. Best of luck in your next chapter, retirement just got the GOAT."

Two tennis legends retire

Williams recently wrote an emotional farewell letter to the world to announce she had made the decision to "evolve away" from tennis.

She had been struggling with injuries and managed to play in just four tournaments throughout 2022, including Wimbledon and the US Open.

It was at Flushing Meadows where the 40-year-old made her final appearance on court and delivered a tear-jerking goodbye speech.

You can watch Serena's speech, including her tribute to sister Venus here.

Williams retires after winning 23 Grand Slam titles, the most of any player of the Open Era, and second-most of all time.

MELBOURNE, AUSTRALIA - JANUARY 28: Serena Williams of the United States poses with the Daphne Akhurst Trophy after winning the Women's Singles Final against Venus Williams of the United States on day 13 of the 2017 Australian Open at Melbourne Park on January 28, 2017 in Melbourne, Australia. (Photo by Clive Brunskill/Getty Images)

MELBOURNE, AUSTRALIA - JANUARY 28: Serena Williams of the United States poses with the Daphne Akhurst Trophy after winning the Women's Singles Final against Venus Williams of the United States on day 13 of the 2017 Australian Open at Melbourne Park on January 28, 2017 in Melbourne, Australia. (Photo by Clive Brunskill/Getty Images)

Federer has confirmed his final tournament will be the Laver Cup in London next week.

The 20-time major champion will bow out on the home soil of the Grand Slam tournament at which he holds the record number of titles.

Federer won eight Wimbledon singles titles throughout his decorated career, with his first coming in 2002. After that, he defended his crown on four occasions, winning the title an astonishing five times in succession.

LONDON, ENGLAND - JULY 08: Roger Federer of Switzerland holds up the winner's trophy after winning his Gentlemen's Singles final match against Andy Murray of Great Britain on day thirteen of the Wimbledon Lawn Tennis Championships at the All England Lawn Tennis and Croquet Club on July 8, 2012 in London, England. (Photo by Clive Brunskill/Getty Images)

The retirement of both Federer and Williams is truly the end of a dominant era in tennis. With two huge icons moving on from the competitive nature of the sport, the door is now very much open for a new generation of incredible talent.