The Swiss ace was returning the favour to Murray by playing the match for Unicef and the Glasgow charity Sunny-sid3up after the Scot had done the same earlier in the year by playing Federer in the Match for Africa 3 in Zurich.
Murray lost the match 6-3, 3-6, 10-6 but was delighted to have made a successful comeback to action four months after ending his 2017 campaign due to a hip injury. The three-time men's singles Grand Slam champion will continue his rehabilitation and hopes to make a return in January.
"I felt better than I expected," Murray said after the first set, as quoted by the Guardian. "I thought I did OK. I've really missed it and I'm just so happy to be back."
"There are things I would have liked to do better but for my first match in four months it was pretty good. My hip felt pretty good, not perfect yet, but it's getting better," he added
The 31-year-old is hoping to return to action in January at the Brisbane International and build match fitness leading up the Australian Open, which begins a week after the aforementioned tournament concludes.
Murray has confirmed that he will reach Australia much earlier in order to acclimatise himself with the conditions. But he also indicated that his return will depend on his fitness as he will only make a comeback if he is 100% fit.
"When I get back on the court again my best form might not come immediately but there's nothing that's making me think I can't find it," Murray told BBC Sport. "I'll come back when I'm ready and 100% fit. I believe I will get back to that."
Federer, meanwhile, is yet to finish his 2017 campaign and would have used the game in Glasgow as preparation for the upcoming ATP Finals in London. The 36-year-old has had one his best seasons in a decade having won seven titles including two Grand Slams.
However, he is no stranger to long injury layoffs after missing the last six months of 2016 recovering from a knee injury. He came back in 2017 and won the Australian Open, which was his first ranking tournament of the season. The Swiss ace has advised Murray to take his time and ensure that he is fully fit before making a return to competitive action.
"My best advice is just to get fit again, seriously that's it," Federer said. "Take your time, however long it takes. When you come back, you want to be at 100%, otherwise, the problem is you feel you just can't beat the best at the big tournaments."