The 20-time grand-slam champion announced last week he would bow out from competitive tennis with one final match at the Ryder Cup-style competition which was his brainchild.
London was the destination for the fifth edition of the Laver Cup, the city for some of Federer's greatest triumphs, but the Swiss superstar could not add one more victory to his illustrious CV.
Team World duo Jack Sock and Frances Tiafoe proved the pantomime villains with a 4-6 7-6 (2) 11-9 victory at the 02 but it was still a celebration for the 41-year-old.
Federer enjoyed a lengthy hug with old sparring partner Nadal, who was also later in tears, at the conclusion of the match before he was given one final standing ovation by a sold-out crowd despite the clock being well beyond midnight.
"We'll get through this somehow," Federer said on-court.
"Look, it has been a wonderful day. I told the guys I'm happy, I'm not sad. It feels great to be here and I enjoyed tying my shoes one more time.
"Everything was the last time. Funny enough with all the matches, being with the guys and having family and friends, I didn't feel the stress so much even if I felt something would go during the match. I am so glad I made it through and the match was great. I couldn't be happier.
"Of course playing with Rafa on the same team, having all the guys here, the legends, Rocket (Rod Laver), Stefan Edberg, thank you.
"It does feel like a celebration to me. I wanted to feel like this at the end and it is exactly what I hoped for so thank you.
"It has been a perfect journey and I would do it all over again…"
Federer had to fight back the tears before he thanked wife Mirka, who has watched him battle through a succession of knee operations before he finally admitted defeat in his pursuit to come back last week.
He added: "Thank you everybody. I've had so many people cheer me on and you guys here tonight mean the world.
"My wife has been so supportive… she could have stopped me a long, long time ago but she didn't. She kept me going and allowed me to play so thank you. She is amazing."
Federer had already been treated to numerous standing ovations at the O2 this week, firstly from reporters at the end of his press conference on Wednesday before again during a practice session alongside the 'big four' a day later.
Another round of applause greeted his entrance onto the court for this 'last dance'. It felt fitting for the Switzerland ace - wearing his white headband - to sign off in London, the home of many of his most famous wins including a memorable first major at Wimbledon in 2003 and then a record 15th grand slam six years later that moved him ahead of old rival Pete Sampras.
When the first ball was hit in anger, after a 10.11pm start, Federer required a matter of seconds before a lightning quick volley at the net brought about a thunderous noise inside the arena.
Alongside his long-term sparring partner Nadal, the competitive juices were flowing when Federer produced a superb serve-and-volley in the seventh game.
The former world number ones were in the mood now and produced clutch tennis at a critical moment to take the opener in 42 minutes after more superb net play by the 41-year-old.
In keeping with this unique situation, Novak Djokovic, the holder of 21 majors, was on hand to offer words of wisdom when required and also one of the most enthusiastically celebrating any point won by the partnership dubbed Fedal.
The tables were turned in the second set and despite Federer's right knee seemingly holding up - it was a succession of operations on that part of his body which saw him finally admit defeat in his attempt to continue playing - tiredness started to set in for both of the hall of famers.
Sock and Tiafoe had warned they were not there to make up the numbers and duly clinched the second set to force a tie-break decider.
While the Americans would eventually claim victory after two hours and 14 minutes, they did so only after a handful of lasts for Federer, who sent down a 116mph ace and a delightful deft drop shot that proved the final winner of a simply extraordinary career.