SPIELBERG, Austria (AP) — By the time his new contract runs out at the end of 2023, Lewis Hamilton could be standing apart as Formula One's greatest driver with 10 world titles.

Mercedes announced Saturday that the seven-time F1 champion signed a two-year contract extension. His current deal was up at the end of this year, when he hopes to clinch an eighth title to move one clear of co-record holder Michael Schumacher.

The 36-year-old British driver is in his ninth season with Mercedes after joining from McLaren eight years ago.

“It is hard to believe it’s been nearly nine years working with this incredible team and I’m excited we’re going to continue our partnership for two more years,” Hamilton said. “We’ve accomplished so much together but we still have a lot to achieve, both on and off the track.”

Hamilton has a close working relationship with team principal Toto Wolff, who was relieved that the contract was finally signed after months of speculation.

“He knows pretty well how he feels about racing, that passion burns strongly,” Wolff told reporters Saturday at the Austrian Grand Prix. “We talked about retirement and it’s always really important to have that flirt with retirement, but equally be in control of your own destiny. There is so much passion for the sport that I can see him going for a while.”

Hamilton currently trails Red Bull's Max Verstappen by 18 points after eight races. Verstappen leads him 4-3 in wins and 3-2 in pole positions.

Wolff added that this season's tight race for the title prompted them to get the contract done.

“We are relishing the battle we have on our hands this year — and that’s why we also wanted to agree this contract early, so we have no distractions from the competition on track,” Wolff said. “In a way, the tough championship has ignited even more fun with us to fight and next year looks really exciting.”

The deal was announced ahead of qualifying for the Austrian Grand Prix, and was quickly welcomed by F1 CEO Stefano Domenicali.

“I am delighted that Lewis will stay in F1 for at least another two years,” Domenicali said. “What he has achieved in this sport is incredible and I know he has more to come. He is a global superstar on and off the race track and his positive impact on Formula 1 is huge.”

Hamilton joined Mercedes in 2013 from McLaren, where he won his first title in 2008. Many observers predicted that it was a risky move, such was Red Bull's dominance at the time.

Red Bull had just won its fourth straight driver's and constructor's titles with Sebastian Vettel at the wheel, and Hamilton won only one race in his first season with Mercedes.

But a switch to hybrid engines turned F1 on its head, and Hamilton has won every title with Mercedes since 2014 with the exception of 2016, when his then-teammate Nico Rosberg clinched the title and retired.

Later Saturday, Hamilton will go for a record-extending 101st F1 pole and a record-extending 99th win on Sunday.

___

More AP auto racing: https://apnews.com/hub/auto-racing and https://twitter.com/AP_Sports