PARIS (AP) — Novak Djokovic will end the year at No. 1 for a record seventh time after rallying to beat Hubert Hurkacz 3-6, 6-0, 7-6 (5) in the Paris Masters semifinals on Saturday.

Djokovic, who also stays on course for a record-extending sixth Paris Masters title, moved one ahead of American Pete Sampras, who secured his six top year-end finishes from 1993-98.

“I'm very proud to finish the season as No. 1,” Djokovic said. “It's a dream, honestly, because Sampras was such an idol for me when I was young. He motivated me to pick up the racket and try this sport.”

Djokovic also finished the year top in 2011-12, 2014-15, 2018 and 2020.

“It’s a huge achievement, obviously,” Djokovic said. “To make the historic seventh time ... (I am) overwhelmed with all the beautiful, positive emotions."

Djokovic eclipsed Roger Federer’s all-time mark of 310 weeks at No. 1 on March 8 and will finish 2021 having held the top ranking for 348 weeks.

Another win on Sunday will give Djokovic a record 37th Masters title to move one clear of fellow 20-time Grand Slam winner Rafael Nadal.

The top-ranked Serb has also reached a record-extending seventh final here, where he faces Russian Daniil Medvedev after losing to him in straight sets in the U.S. Open final two months ago. Djokovic had not played since.

“Hopefully I’ll be able to turn the tables,” Djokovic said.

Second-seeded Medvedev routed No. 4 Alexander Zverev — the Olympic champion — 6-2, 6-2 for a fourth straight win against him, having also beaten him in last year's final. They are now 5-5 overall.

Medvedev, the defending champion, was clinical.

He sealed the first set at the first go when Zverev returned his strong second serve into the net and victory on his first match point at 40-15 when Zverev could only pat a strong serve wide.

Djokovic leads Medvedev 5-4 overall. They have split the last two meetings, both majors, with Djokovic winning in straight sets in the Australian Open final this year.

“He’s been playing fantastic tennis, he’s back at his best," Djokovic said. "He’s not missing much and serving big, it seems like he’s finding the groove.”

Djokovic was in his 71st Masters semifinal and Hurkacz just his second.

But Hurkacz forged the first break point of the match in the eighth game and took it with a backhand volley at the net for 5-3.

Djokovic had a chance to break back with Hurkacz 30-40 down in the next game, but the Serb made two sloppy unforced errors and Hurkacz took the first set on his second set point with a strong first serve that Djokovic returned long.

Djokovic hit back in an imperious second set and took control of the decider with a strong service game to move 4-1 up.

But Djokovic’s double-fault in the seventh game gave Hurkacz two break points. Djokovic sarcastically applauded the crowd after some of them had cheered his double-fault.

“In the heat of the battle, things can happen. People get involved in the match,” Djokovic said. “Of course I did not like that ... It’s not the first time, probably not the last time.”

The Parisian crowd had also loudly cheered errors and double-faults from players who were up against Frenchman Hugo Gaston on Thursday and Friday.

“Obviously playing against a French player is a whole different atmosphere,” Djokovic said. “You could see that both (Carlos) Alcaraz and Medvedev were feeling uncomfortable on the court with that crowd being involved so much and being loud.”

Djokovic was much more comfortable holding for a 5-4 lead, and sat in a meditative pose during the changeover.

Serving to stay in the match, Hurkacz was at deuce when Djokovic edged a 25-shot rally to forge a first match point.

He saved it on second serve when Djokovic’s backhand landed just wide. He then held with an ace for 5-5.

The tiebreaker was close at 5-5 when Hurkacz’s loose forehand into the net gave Djokovic a second match point and he clinched victory when Hurkacz’s sliced backhand at full stretch landed just wide.

Djokovic beat his chest three times and let out a roar as he celebrated his victory, then applauded his opponent off court.

Hurkacz broke into the Top 10 for the first time last month and has qualified for the eight-man season-ending ATP Finals, which start on Nov. 14 in Turin.

Djokovic will also be looking for a record-equaling sixth ATP Finals title to tie with Federer.

___

More AP tennis: https://apnews.com/hub/tennis and https://twitter.com/AP_Sports