Ferrari have confirmed Lotus driver Kimi Raikkonen will join Fernando Alonso at the Italian team from 2014 after agreeing a two-year contract.
Raikkonen, 33, won the world title with Ferrari in 2007 but was displaced by the arrival of Spaniard Alonso in 2010.
The Finn will replace Felipe Massa, who announced via Twitter that he will leave at the end of the current season.
Raikkonen said: "I'm really happy to return to Maranello where I spent three fantastic and very successful years."
"I can't wait to be driving a Ferrari car again and to reacquaint myself with so many people with whom I had such close links, as well as working with Fernando, whom I consider a great driver, in order to bring the team the success it deserves."
Lotus are expected to replace Raikkonen with Sauber's German driver Nico Hulkenburg.
Raikkonen had also been linked with a move to Red Bull after impressing with victory in the opening race of 2013 at the Australian Grand Prix, followed by second-place finishes in China, Bahrain, and Spain.
Red Bull opted to promote Daniel Ricciardo from their Toro Rosso junior team rather than continue to pursue Raikkonen.
Raikkonen is only in his second season back in Formula 1 following a two-year break during which he pursued a career in rallying.
His 2012 return was marked with seven podium finishes, including in the penultimate race of the season.
Ferrari's decision to partner Alonso with Raikkonen signals a return to the policy last employed between 2007 and 2009 when Raikkonen and Massa competed on equal terms.
Either side of that period, with Michael Schumacher from 1996-2006 and then with Alonso for the last four years, there has been a clear number one driver.
Former world champion Sir Jackie Stewart, who works as a consultant for the Lotus team, told BBC Sport that
Alonso's relationship with McLaren, when he was team-mates with Lewis Hamilton in 2007, was famously turbulent, and the ructions led to him leaving the team just one year into a three-year contract.
Alonso has since made it clear that his problems at the time were not with Hamilton but with the team not delivering on promises that had been made to him about his status.
And in a statement on the Ferrari website, he paid tribute to Massa and looked forward to Raikkonen joining the team.
"It will not be easy to say goodbye to a team-mate like him. He has always been truly professional and loyal to the team and I am sure that right to the end, he will do his utmost for the Scuderia that he loves so much.
"I'd like to welcome my new travelling companion: together, starting next year, we will have to tackle a very demanding technical and racing challenge."
Ferrari's decision, which was approved by the team's president Luca Di Montezemolo, leaves Lotus with a second key vacancy to fill.
They also lost highly-rated technical director James Allison to Ferrari earlier this year and have since struggled to persuade Raikkonen that they have the technical and financial resources to compete at the front in 2014.
Raikkonen is the first driver to return to Ferrari after a previous spell since Austrian Gerhard Berger re-joined them in 1993 after leaving them at the end of 1989 to join McLaren.
Ferrari trail Red Bull by 104 points in the team standings this season, with Alonso's successes in Spain and China dwarfed by rival Sebastian Vettel's six wins.