In this file photo taken on July 12, 2019 Switzerland s Roger Federer (R) shakes hands and embraces Spain s Rafael Nadal (L) after Federer won their men s singles semi-final match on day 11 of the 2019 Wimbledon Championships at The All England Lawn Tennis Club in Wimbledon, southwest London. AFP
Federer, 41, said he would retire after the Laver Cup in London later in September, having not played since Wimbledon 2021 because of a knee problem.
"Dear Roger, my friend and rival, I wish this day would never have come," Nadal wrote on Twitter.
"It's a sad day for me personally and for sports around the world. It's been a pleasure but also an honour and privilege to share all these years with you, living so many amazing moments on and off the court."
Federer, a 20-time Grand Slam champion, is only behind Nadal (22) and Novak Djokovic (21), on the list of most men's singles majors.
They have faced each other 14 times at Grand Slam events, with Nadal winning on 10 occasions and Federer four.
"We will have many more moments to share together in the future, there are still lots of things to do together, we know that," continued Nadal.
"For now, I truly wish you all the happiness with your wife Mirka, your kids, your family, and enjoy what's ahead of you. I'll see you in London at (the) Laver Cup."
The hard-court tournament, from September 23-25, sees tennis stars from Europe face others from the rest of the world, with Nadal and Federer together on 'Team Europe'.
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO_Sports and on Facebook at AhramOnlineSports.)