Giancarlo Fisichella will be the second Ferrari driver from the Italian Grand Prix, after he was released from his contract by his Force India team on Thursday.
The announcement was made by Force India, which confirmed that Fisichella would switch teams from the Italian Grand Prix.
The team said that discussions with Ferrari began in the last 24 hours, once it became clear that Massa was out for the season.
Force India owner Dr Vijay Mallya said: "Giancarlo and his management team approached me yesterday with the proposal from Ferrari.
"For any Italian driver, a Ferrari race seat is a long-held dream and for Giancarlo it was no exception. No one should stand in the way of this.
"Furthermore the agreement will secure Giancarlo's long-term future with Ferrari and it would be incorrect to jeopardise this, particularly when Giancarlo has made such a vital contribution to Force India."
Force India is understood to have outstanding debts with Ferrari left over from its customer engine supply deal that ended last year - but Mallya said that commercial factors did not have a role in the outcome.
"We would like to stress that we have not agreed any financial settlement with Ferrari," he said. "This agreement has been made in good faith and for the good of Giancarlo and the sport in general. A competitive Italian driver in a Ferrari for Monza is a positive story for Formula One, which can only help raise the sport's profile in these difficult times.
"We would like to thank Giancarlo for all his help over the past one and a half seasons and for delivering us our first World Championship points last weekend. He has been an integral part of the team and we owe him a great deal for his input behind the scenes and performance out on track. We wish him all the best for the future."