McLaren will renew their once-revered partnership with Mercedes from 2021, the German manufacturer and British racing team announced at the Russian Grand Prix on Saturday.
Mercedes will succeed Renault as McLaren's engine-supplier when their current contract ends next year.
The former champions have agreed a long-term deal with Mercedes that will run to 2024 and, if successful, beyond.
The confirmation of the deal was made in a joint statement in which Mercedes motorsport boss Toto Wolff said he was delighted to "welcome McLaren back to the Mercedes-Benz racing family".
"We hope that this new long-term agreement marks another milestone for McLaren as they aim to take the fight to the sport's top teams, including our Mercedes works team," said Wolff.
McLaren won 78 races, three drivers' championship titles and one constructors' title during their previous partnership with Mercedes from 1995 to 2014 before an ill-fated return to Honda.
Championship leader and defending five-time champion Lewis Hamilton took his first title with McLaren-Mercedes in 2008. Mika Hakkinen won two titles with them in 1998 and 1999.
McLaren are currently in a rebuilding period with a driver line up of Spaniard Carlos Sainz and British rookie Lando Norris.
The team is without a race win since 2012, but have recovered from a dismal spell to become one of the contenders for fourth place in this year's constructors' championship.
McLaren team chief Zak Brown said: "This agreement is an important step in our long-term plan to return to success in Formula One."
The start of the new deal will coincide with the introduction of a new identity and set of rules for Formula One.
Mercedes supply engines to their own factory team, Racing Point and Williams.