Eight time Wimbledon winner Roger Federer has lost his second round match at the Halle Open just two weeks out from the third Grand Slam of the year.

Federer, who withdrew from the French Open earlier this month to prepare for Wimbledon, lost to 20-year-old Canadian Felix Auger-Aliassime 4-6 6-3 6-2 in an hour and 44 minutes.

It was the first time in 18 appearances that the 39-year-old failed to reach the Quarterfinals in Halle, played on his favourite surface of grass.

“It's a huge challenge for me. Everybody who has been in multiple surgeries or a tough surgery knows what I'm talking about,” Federer said after the match.

“Things don't come simple, they don't come easy. You second-guess yourself rather quickly unfortunately, and that's sometimes the biggest worry: the worry of pain or the worry of how you're going to feel the next day or when you wake up, the first steps, how did they feel? All this stuff, it takes a little bit of a toll on you sometimes.”

“Of course I know Felix is a great player and he was better today. I would have maybe lost anyhow. But it's a tough court to play on, so it makes me really happy looking back at how grateful I can be about how well it's gone here in Halle and how difficult it is to win here,” Federer said.

“This type of third set I cannot accept. The first two are totally okay, no problem there. But I guess it happens and it's all good from my side.”

Federer won the tight opening set before falling in the second and going down 0-3 to begin the third. Auger-Aliassime converted just three of 15 break points against the 20-time Grand Slam winner but served 13 aces to Federer's five.

“The good thing coming out of a match like this against a great player is I know what I need to think about moving forward. Clearly I need to do a bit better, but overall I thought also Felix played a great match. He stayed mentally very solid. He showed that he wanted to win and he was better at the end." Federer said.

Wimbledon, the oldest tennis tournament in the world, gets underway on Monday June 28. Federer, who will be striving for his record 21st Grand Slam trophy, is not expected to play in a competitive match before Wimbledon.

Auger-Aliassime will now play American Marcos Giron in the Halle Quarter-final.