Alonso has endured a frustrating season with Renault
Ferrari have announced that double world champion Fernando Alonso will join them for 2010 from Renault, with Kimi Raikkonen making way.
Ferrari said the Spaniard had signed a three-year contract and that he would partner Brazilian Felipe Massa.
"Driving a single-seater for the Prancing Horse is everybody's dream in F1, and now I have the chance to make this dream come true," said Alonso.
The 28-year-old said the move had been brought forward by a year.
Alonso's switch to Ferrari had been the worst-kept secret in F1, and the announcement is likely to trigger a string of driver moves.
"I'm very happy and very proud to become a Ferrari driver," said Alonso.
I can't wait to start working with my new team
"Above all I want to thank Ferrari chairman Luca di Montezemolo, who really wanted this three-year contract.
"We had an agreement this summer, starting in 2011, but then over the last few days the picture changed and we decided to anticipate my arrival in Maranello by one year."
"After this season [which has three races remaining] I will put all my effort into next," he added.
"I'm sure, together with Felipe, we'll offer Ferrari and the fans from all over the world some great satisfaction. I can't wait to start working with my new team."
Ferrari team boss Stefano Domenicali, who described Alonso as an "amazing talent", paid tribute to Raikkonen's contribution to the team.
"We wish to thank Kimi for everything he has done during his time with Ferrari," he said.
"In his first year with us he managed to win the drivers' title [in 2007], so making his contribution to Ferrari's history, and he played a vital role in our taking of the constructors' title in 2007 and 2008."
The Finn is tipped to join McLaren-Mercedes although a spokesman said the Anglo-German team had yet to make a decision on a team-mate for Lewis Hamilton.
Raikkonen added: "I am very sad to be leaving a team with whom I have spent three fantastic years.
"I have always felt at home with everyone here, and I will have many happy memories of my time with the team."
F1 boss Bernie Ecclestone gave Alonso's Ferrari switch his blessing: "It is good. Good for Fernando, good for Formula 1, good for Ferrari."
As part of the cascade of driver moves that will follow Alonso's switch, BMW Sauber's Robert Kubica is understood to have signed a contract to replace Alonso at Renault.
Alonso's switch to Ferrari has been an open secret in F1 for weeks and BBC Sport understands he signed his contract as long ago as July 2008.
A Ferrari source told BBC Sport there are options to extend Alonso's deal, and that he will be earning an annual salary in the region of 19-25 million euros (£17.3-£22.8m).
Raikkonen had a contract with Ferrari until the end of 2010, but the team have negotiated an early release.
Massa is recovering at home in Brazil after suffering a fractured skull in an accident at the Hungarian Grand Prix in July.
Ferrari's expectations that he will return fully fit in 2010 have been boosted by his progress: on Monday he tested a kart for the first time since his accident and he is flying to Italy to use Ferrari's simulator next week.
Italian Giancarlo Fisichella, who is standing in for Massa in the final few races of the season, will be Ferrari's test and reserve driver in 2010.
Alonso's move brings to an end his relationship with Renault, for whom he has driven in all but two of his eight years in F1.
He was cleared of any involvement in the recent race-fixing scandal, in which Renault were found to have asked his team-mate Nelson Piquet Jr to crash at the 2008 Singapore Grand Prix to aid Alonso's chances of victory.
Alonso, not Raikkonen, will be wearing the red overalls of Ferrari in 2010
Alonso made his F1 debut for Minardi in 2001, moved to Renault as their test driver in 2002 and was promoted to their race team in 2003.
He became the youngest race-winner in F1 history when he won the 2003 Hungarian Grand Prix, and its youngest world champion in 2005, though he has lost those marks to Sebastian Vettel and Lewis Hamilton.
Alonso went on to win a second consecutive championship in 2006, beating Ferrari's Michael Schumacher in a straight fight, before moving to McLaren as Hamilton's team-mate in 2007.
However, his relationship with the team was tempestuous and he left after just one season to rejoin Renault.
On his return he won the 2008 Singapore Grand Prix and, with one of his best performances, the following race in Japan, but the team have been uncompetitive this season.