Focused and fired up, Nick Kyrgios came through his stiffest test yet at the Australian Open on Friday, beating the former runner-up Jo-Wilfried Tsonga 7-6 (5), 4-6, 7-6 (6), 7-6 (5) to reach the fourth round. Both men bashed 28 aces in Rod Laver Arena but the No 17 seed, the lone Australian remaining in the men’s draw, played his best when he needed to and he will now face Grigor Dimitrov for a quarter-final spot.

Tsonga had a set point in the third set and led 5-2 in the fourth-set tiebreak but Kyrgios held firm. There has not been an Australian men’s champion here since Mark Edmondson in 1976, and though there are many obstacles in his path the 22-year-old is in the mix.

“It was amazing,” Kyrgios said. “Playing Jo, obviously I was very nervous. He was a guy I looked up to as a kid, I still do, he’s a champion, I’m just happy to get through. [Being] 5-2 down in the fourth-set breaker, I was kind of getting ready for a fifth set mentally. I somehow just hung in and got a couple of looks. It was surreal out there today, that win.”

When Kyrgios was given a code violation for not being ready to start in the allotted time, tempers could have frayed but the Australian kept his cool and smiled.

Both men began serving bullets and though Kyrgios struck first, breaking in the third game, the Frenchman hit back to level at 3-3 with the help of a dead net-cord. A couple of aces helped Kyrgios get out of trouble at 4-5, 15-30. Kyrgios led 6-4 in the tiebreak and a Tsonga double-fault gave it to him 7-5.

Jo-Wilfried Tsonga lost his temper with a fan inside Rod Laver Arena during his match against Nick Kyrgios. Photograph: Peter Parks/AFP/Getty Images

Kyrgios dropped his intensity at the start of the second set and the 32-year-old Tsonga, who reached his only grand slam final here 10 years ago, hit back. The Frenchman had needed five sets to get past Denis Shapovalov in the previous round but showed no sign of fatigue as he broke for 3-2, serving beautifully and producing some soft touches at the net.

Instead it was Kyrgios who was losing concentration. “Why the fuck did I play doubles?” he said, at the change of ends, referring to his effort in searing temperatures the previous day. Tsonga maintained the advantage to level the match.

“My legs felt a little bit heavy,” Kyrgios said. “Yesterday was hot. I played a two-hour doubles match. It took a lot out of me. I think the adrenaline kicked in the third and fourth sets. I had a couple of bananas, started to feel better, got a bit of a second wind.”

The third set was an exhibition of serving from both men. A brilliant backhand pass down the line gave Kyrgios the mini-break in the tiebreak for a 4-2 lead but a mis-hit forehand handed the break back for 4-4. Tsonga had a set point at 6-5 but Kyrgios saved it with a big forehand winner. A huge serve and easy forehand created set point and an angled backhand return sealed the set.

An angry Tsonga exchanged words with a fan who had been commenting between first and second serves on set point but he regained his focus as the fourth set again headed to another tiebreak. This time it was Tsonga who got the early mini-break, a Kyrgios double-fault helping him on the way to a 4-1 lead as he moved forward at every opportunity. Tsonga extended his lead to 5-2 but Kyrgios reeled off five straight points, finally clinching victory when Tsonga netted a forehand.