If there was any doubt that Milos Raonic is quickly regaining form, it was put to rest on Friday afternoon when he beat Sam Querrey 7-5, 2-6, 6-3 for a spot in the semifinals of Indian Wells.

The victory for the 27-year-old Canadian sets up a final four tie against world number eight Juan del Potro of Argentina, seeded sixth in the California desert. Raonic is the 32nd seed as he works toward regaining the consistency that took him to lofty heights at third in the world in 2016 before wrist and leg injuries ravaged him last season.

The 18th seed American, Querrey, put up stiff resistance at the ATP Masters 1000 tournament, breaking Raonic in the opening game and looked to be cruising to an early lead until disaster struck when he was up 5-4 and serving for the set. As he had done against Joao Sousa in the third round facing a similar deficit, Raonic persevered and forced a break point. A backhand volley from Querrey into the net put the Canadian back on terms and he went on to win the next two games for the set at 7-5.

Querrey managed to put that disappointment behind him and punished Raonic for his mistakes in the second set. The Canadian made 11 unforced errors, and committed four double faults on way to dropping two service games to Querrey, who pulled level by winning 6-2 in the second.

The decisive third set was going swimmingly for both players until Querrey stumbled in the eighth game to go down 5-3, an unenviable position against the big-serving Canadian now with the match on his racket. Querrey threw everything he had at Raonic to salvage the match, including forcing his opponent to save an early break point. After fending off a match point, Querrey then had two more chances to break Raonic, but each time the Canadian served his way out of trouble, firing his 16th and 17th aces on the day before closing out the set at 6-3 for a semifinal spot.

“I’m not very good with rollercoasters,” Raonic joked with tournament organizers in a post-game interview, “but I prefer them on the tennis court rather than the real ones. I’m very happy with the way I was able to put it together today.”

Raonic’s win preceded del Potro’s three-set 3-6, 6-3, 6-4 victory over Philipp Kohlschreiber of Germany, setting up a rematch of their semifinal encounter at Delray Beach, Florida early last season when the Canadian pounded 17 aces, won 83% of his first serves, and saved a break point to win in straight sets. Raonic then missed the final due to injury, foreshadowing a difficult year. In their three career head-to-head outings Raonic won twice, and he’d like nothing more than to continue his renewal.

“Every match is important, that’s one thing I miss playing — matches. The more opportunities I have to come back out on the court the happier I am.”

Saturday’s semifinal will mark the third time in four years Raonic has reached this stage at Indian Wells. He missed last season’s tournament due to injury; in 2016 lost in the final to Novak Djokovic, and the previous year Roger Federer ousted him in the semis.

Federer is featured in the other semifinal this year, where he’ll meet 21-year-old Borna Coric, the 49th ranked player on tour from Croatia who has defeated three seeded players on his way to face the world’s top tennis talent in Federer. Coric’s conquests at Indian Wells include seventh seed and ATP no. 9 Kevin Anderson.