John McEnroe's side entered the final day of the three-day event in London trailing four-time champions Team Europe 4-8.
Roger's career has been a rollercoaster of a ride. He has been at the pinnacle of success and also experienced many downfalls that tested his resilience and determination to get back up.
The tennis legend said that the last 24 years on tour have been an incredible adventure for him.
"I wish him all the best and I hope he recovers quickly so we see him back on the courts. He could have won the match at the end. Obviously, he was the better player, so I definitely got a bit lucky," added Federer.
World No. 1 Novak Djokovic of Serbia, who beat Federer in the 2019 Wimbledon final, might have to overcome Greece's Stefanos Tsitsipas or two-time champion Andy Murray, in the semi-finals.
"It's an amazing win, and I for sure didn't expect this. Of course you come into the match wanting to win, but Roger was my idol, like many of us growing up," Auger-Aliassime said after the match.
Berrettini advances to his second Grand Slam quarter-final. The Italian will next play world No.1 Novak Djokovic or Italian Lorenzo Musetti.
Mairaj, who will be competing in his second Olympics after the 2016 Rio Games, is the oldest shooter in the 15-member shooting contingent.