Fernando Alonso has agreed a new deal to remain with McLaren for the 2018 Formula One season.
The two-time Formula One champion has been critical of his team in a frustrating season that has only brought him 10 points.
McLaren will switch from Honda to Renault power units next year after a 2017 to forget and Alonso has decided to stay put as Stoffel Vandoorne's team-mate.
The Spaniard said: "It's fantastic to be able to continue my relationship with everybody at McLaren.
"It was always where my heart was telling me to stay, and I really feel at home here. This is a fantastic team, full of incredible people, with a warmth and friendliness that I've never experienced elsewhere in Formula 1. I'm incredibly happy to be racing here.
"Just as important, McLaren has the technical resource and financial strength to be able to very quickly win races and world championships in F1. Although the last few years have not been easy, we have never forgotten how to win, and I believe we can achieve that again soon.
"The last three years have given us the momentum to plan and build for the future, and I'm looking forward to that journey.
"I'm excited for our future together – and I'm already working hard to make it a success."
Alonso, who missed the Monaco Grand Prix to race in the Indianapolis 500, had warned the Woking-based team that they must provide him with a car capable of winning to convince him to stay.
Racing director Eric Boullier spoke of his delight that the 36-year-old has agreed to a fourth season with McLaren.
He said: "With Fernando, you really can't ask for a better driver to deliver a result for you on a Sunday afternoon – and I think everybody in Formula 1 would acknowledge that sentiment.
"He's always been clear to me that this is a team he loves, and that his heart has always been set on staying. Today's announcement shows that he's fully committed to racing and winning as a McLaren driver, and, while we've often shared his frustrations over the past few years, we now feel that we can deliver on our promise to give him a competitive car next season.
"Consistency of driver line-up is one of those small but essential elements that really helps a team to maintain momentum, and, with Fernando and Stoffel, we're lucky to be writing a fresh chapter with what we believe to be the best driver line-up in Formula 1."