"I'm very happy and very proud to become a Ferrari driver. Driving a single-seater from the Prancing Horse is everybody's dream in this sport and today I have the opportunity to make this dream come true," Alonso said on Ferrari's website.
Rumors of Alonso moving to Ferrari have been going around since 2007 when he was released by McLaren one year into his three-year contract with the team.
Ferrari team principal Stefano Domenicali said Alonso will join Felipe Massa next season, while Giancarlo Fisichella stands as the team's reserve driver. Raikkonen leaves the team after three years of racing for Ferrari.
"With common consent, we have agreed to terminate the contract binding me to Ferrari to the end of 2010, one year ahead of schedule," Raikkonen said. "I am very sad to be leaving a team with which I have spent three fantastic years, during which time I won plenty of races."
Alonso's contract with Ferrari will run for three years starting 2010, a year ahead of the initial schedule based on earlier talks between both parties.
"I'm sure that, 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," Alonso said.
Alonso is the second Spanish driver to compete for Ferrari after Alfonso de Portago raced for the team in 1956 and 1957.