Murray, who hasn't played since a quarterfinal loss at Wimbledon in July due to a lingering hip injury, looked more comfortable as the match wore on but Federer showed the class that has seen him win seven titles in 2017 to prevail 10-6 in a Championship tiebreaker after the first two sets were split.
It was Federer's first tennis match in Murray's native Scotland, and the 19-time Grand Slam champion didn't disappoint.
The Swiss star adored himself to the local crowd by wearing a traditional tartan kilt for a service game in the second set, which he won. Murray also donned a Scottish bonnet with ginger hair out the back.
It was a successful return to the sport for Murray as he eyes a comeback to the professional circuit next year.
The Scot hopes to be fit for the season kick-off in 2018 with an appearance at the Brisbane International, which starts on New Years Eve.
Before the match against Federer, Murray was asked whether he could get back to 100 percent fitness.
Murray said: "You never know when you're coming back from any injury, but that's what I'm working towards, for sure. We have to see, but I believe that will be the case.
"When I get back on the court next year and start playing again, it might not come immediately at the beginning of the year.
"I have been hitting the ball very well in practice -- it's just that there is a difference between that 75-80 per cent practice and going flat out at 100 per cent for two and a half or three hours on the match court. Until I do that I can't say for certain, but I think I'll be able to come back just fine."
Murray plans on getting to Australia early to acclimatise in a bid to offset his lack of sharpness, but he will not feel compelled to play if he is not totally fit.
"Things have been going pretty well so far in the rehab, but you just never know," said Murray, whose medical team chose rest and recovery instead of surgery.
"I've been training for a few weeks now. Some days I've felt great and some days not so good.
"But I will come back when I'm ready and when I'm 100 per cent fit. I probably made a bit of a mistake trying to get ready for the US Open but it was the last major of the year and I wanted to give it a go.
"And now it's time to give my body the rest and recovery it needs. I'll come back when I'm ready."
Federer had reinforced that message moments earlier. The 36-year-old had a similar lay-off last year after struggling with knee problems and came back rejuvenated, winning his first Grand Slam event for five years at Wimbledon and following it up with a US Open triumph.
He told Murray: "Take your time, however long it takes. When you come back you want to be at 100 per cent, otherwise the problem is you feel you just can't beat the best at the big tournaments, so it's wise and worthwhile to take the extra week, extra month maybe.
"I'm sure Andy is going to have a lot of years left, so he shouldn't hurry, but as a professional athlete you always want to come back as quick as possible.
"You need to have goals but sometimes they need to be postponed."
The Press Association contributed to this report.