Carlos Sainz will drive for Ferrari from the 2021 Formula One season after being announced as the replacement for Sebastian Vettel.
The 25-year-old Spaniard made his F1 debut in 2015 and finished an impressive sixth in the drivers' standings for a resurgent McLaren last year.
Ferrari clearly deemed he could provide the ideal foil for Charles Leclerc, who is expected to be their lead driver for the foreseeable future.
"I am very happy that I will be driving for Scuderia Ferrari in 2021 and I'm excited about my future with the team," Sainz said.
"I still have an important year ahead with McLaren Racing and I'm really looking forward to going racing again with them this season."
Daniel Ricciardo will step in as team-mate to Lando Norris at McLaren, with his switch from Renault for 2021 confirmed shortly before Ferrari's announced Sainz's signing on Thursday.
According to reports in Spain, the Scuderia first made contact with Sainz in 2019 and talks ramped up last week when Vettel's intentions became clear.
He has entered 102 grands prix across stints with Toro Rosso – now AlphaTauri – Renault and McLaren and secured the first podium of his career by finishing third at last year's Brazilian Grand Prix.
Ferrari team principal Mattia Binotto said: "With five seasons already behind him, Carlos has proved to be very talented and has shown that he has the technical ability and the right attributes to make him an ideal fit with our family.
“We've embarked on a new cycle with the aim of getting back to the top in Formula 1. It will be a long journey, not without its difficulties, especially given the current financial and regulatory situation, which is undergoing a sudden change and will require this challenge to be tackled in a different way to the recent past.
"We believe that a driver pairing with the talent and personality of Charles and Carlos, the youngest in the past fifty years of the Scuderia, will be the best possible combination to help us reach the goals we have set ourselves."
Sainz's final season with McLaren is due to commence at the Austrian Grand Prix in July, with the campaign having been significantly delayed by the coronavirus pandemic.