The pair faced each other 40 times, including in nine grand slam finals, and played some of the sport's greatest matches.
Nadal wrote on social media: "Dear Roger, my friend and rival. I wish this day would have never come. 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.
"We will have many more moments to share together in the future, there are still lots of things to do together, we know that. 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 @LaverCup."
Federer announced earlier on Thursday that next week's Laver Cup in London will be his final professional tournament after more than a year trying to recover from a third knee operation.
Wimbledon thanked their eight-time champion in a tweet which read: "Roger, where do we begin? It's been a privilege to witness your journey and see you become a champion in every sense of the word.
"We will so miss the sight of you gracing our courts, but all we can say for now is thank you, for the memories and joy you have given to so many."
The ATP Tour issued its own tribute to Federer, simply saying: "You changed the game, #RForever. "
ATP chairman Andrea Gaudenzi added: "Roger's impact on tennis, and the legacy he's built, are impossible to overstate. Over 24 years as a professional, Roger brought millions of adoring fans into the game.
"He spearheaded an incredible new era of growth and elevated the popularity of our sport. Few athletes have transcended their field in such a manner. Roger made us all feel proud and fortunate to be part of the same sport."
Billie Jean King, who won 12 women's singles grand slam titles, added her tribute to Federer on Twitter.
"Roger Federer is a champion's champion," she wrote on her official account.
"He has the most complete game of his generation & captured the hearts of sports fans around the world with an amazing quickness on the court & a powerful tennis mind. He has had a historic career w/memories that will live on and on.
"Congratulations, Roger Federer. We wish you the very best as your journey continues."
Responding to Federer's retirement letter, Martina Navratilova wrote on Twitter: "What a heartfelt message, full of love, life, hope, passion and gratitude. Which is exactly how Roger played the game we love so much. Thank you thank you thank you, for all the magic!!!"
Rod Laver, after whom Federer named the Laver Cup, wrote simply: "Thank you for everything Roger. See you soon. Rocket"
Federer's rivals also paid their tributes. Andy Roddick, beaten in three Wimbledon finals, wrote on Twitter: "Cheers Roger. Thanks for the shared memories my friend. It was an honour to share time/experiences on the most hallowed grounds in our sport. Don't be a stranger.
Also, seems like a good time to start training for Wimby (Obviously kidding)."
Juan Martin Del Potro, the only player other than Rafael Nadal and Novak Djokovic to beat Federer in a grand slam final, said on Instagram: "You made tennis a unique sport.
"Thank you for teaching us with your example, in and out court. I'm thankful for sharing your journey and being able to play so many matches together.
"Thank you. Thank you for testing us all, raising our standards in every tournament we played, for everything you've given for our sport, for how warm you always were with me, and so many other things. I'm sad, this is something I didn't want to hear. I do wish you a great life with Mirka and your kids."
Carlos Alcaraz appears set to carry the mantle as the new US Open champion and world number one, and he said on Twitter: " Roger has been one of my idols and a source of inspiration! Thank you for everything you have done for our sport! I still want to play with you! Wish you all the luck in the world for what comes next!"
Women's US Open champion Iga Swiatek added her tribute. The Polish player said on Twitter: "I just want to thank you for everything you've done and everything you are for our sport.
"It's been a privilege to witness your career. I wish you all the best."
International Olympic Committee president Thomas Bach said: "@RogerFederer is a gentleman on and off the court - and a true Olympic champion. Congratulations Roger on your outstanding career, good luck for the future. Hope our paths will cross again."
Indian cricket great Sachin Tendulkar, a well-known tennis fan, also Tweeted his tribute, saying: "What a career, @rogerfederer. We fell in love with your brand of tennis. Slowly, your tennis became a habit. And habits never retire, they become a part of us. Thank you for all the wonderful memories."