Austin, Texas - Double world champion Fernando Alonso will race on with McLaren in 2018, the team said on Thursday in an announcement that finally ended one of the sagas of the Formula One season.
The 36-year-old Spaniard told reporters at the US Grand Prix: "I'm extremely proud and happy to be part of the project for next year. The challenge is big, I'm motivated more than ever, and happy to start working for 2018."
McLaren executive director Zak Brown said the multi-year agreement "allows Fernando to be with us for quite some time".
"Our desire is that for however long Fernando wants to keep driving, and whatever that is that he wants to keep driving, that he does it with McLaren," he added.
Chasing the Triple Crown
Alonso dreams of becoming only the second driver to achieve motorsport's Triple Crown but needs to win Le Mans and the Indianapolis 500.
He missed the Monaco Grand Prix this year to compete at Indianapolis and Brown said Alonso would be able to enter other events when that did not compromise McLaren's F1 interests.
Le Mans does not clash with any F1 race next year, but Alonso said he had yet to talk to anyone about that.
Alonso has endured three nightmare years at McLaren and refused to commit to staying until the former champion felt it could provide him with a competitive car. He said he had considered leaving Formula One and had also talked to other teams, who had won this season, during the August break.
McLaren then ended its troubled partnership with Honda, under increasing criticism from Alonso, and will switch to Renault engines in 2018.
Alonso won his 2005 and 2006 titles with Renault but has not been on the podium since 2014, when he was with Ferrari. His last win was in Spain in 2013, also with Ferrari.
McLaren is currently ninth overall, out of 10 teams, and the season ranks as the worst of Alonso's career with the exception of his debut year with now-defunct tail-ender Minardi.
He has scored points only twice in 16 race in 2017, with six retirements, and failed to start in Russia while also missing Monaco to compete at the Indianapolis 500.
"Something inside always told me to stay at McLaren," he said on Thursday. "I think this year we have proved that the chassis was capable of fighting at the front. We saw a lot of progress.
"The organisation now is much more logical in the way of winning in the short-term in Formula One. After the summer break, maybe around Spa or Monza, I was ready to make an extension to the contract."
Asked whether he felt he could win a third title with McLaren, he replied: "That's why I stay."
Brown said continuing with Alonso, as team-mate to Belgian Stoffel Vandoorne, was "very, very important for McLaren's future".
"Obviously the last few years have been a big challenge," he said, "What you want is the best team and the best drivers in the world that you can get
"Our shareholders have ambitious plans for the group, and success within Formula One is a central pillar of that strategy. With Fernando, there is no doubt that we have a driver who can help us achieve our goal of winning again in F1."