Roger Federer suffered a shock defeat to 39-year-old Tommy Haas at the Stuttgart grass court tournament on Wednesday in the Swiss great’s first match after almost three months out of action.

Haas, a former world number two but now down at 302, won 2-6, 7-6 (10/8), 6-4 for just his fourth victory in 17 meetings against his close friend.

Federer, building up for an assault on an eighth Wimbledon title, hadn’t played since March and skipped the entire clay court season.

It was just the second defeat of 2017 for 35-year-old Federer, who had claimed his 18th major at the Australian Open in January.

“It’s always special to play a close friend like Roger on grass, always lots of emotion,” said Haas.

“I saved a match point in the second set so was able to play more freely after that.

“I even shocked myself.”