20-time Grand Slam champion defied injury to beat unseeded Tennys Sandgren in Australia Open quarter-finals.

The 38-year-old had a medical timeout in the third set for a groin problem and World number 100 Sandgren looked set to be the lowest ranked player to reach the Melbourne semi-finals since 1991.

But Federer fought off the injury and stunningly won  6-3 2-6 2-6 7-6 (10-8) 6-3.

“You’ve got to get lucky sometimes I tell you that,” Federer said. “Sometimes you’re not under control.

“I just hoped he wouldn’t smash a winner, just keep the ball in play and if he does miss one of two then see what is going through his mind.

“As the match went on I felt better and the pressure went away.

“I didn’t deserve this one but I’m standing here and I’m obviously very happy.”

Both men shook hands at the net, Sandgren wishing his rival luck before trudging off to a standing ovation from the 15,000 fans who couldn’t believe what they had seen.

Federer will play Serbia’s defending champion Novak Djokovic or Canadian 32nd seed Milos Raonic in the semi-finals.