Michael Schumacher will make a shock return to Formula 1 to replace injured Ferrari driver Felipe Massa.
The seven-time world champion retired at the end of 2006 but will drive at the European Grand Prix on 23 August.
Ferrari said the 40-year-old will stand in for as long as Massa is sidelined by the serious head injuries he sustained in the Hungarian Grand Prix last week.
"For team loyalty reasons I can't ignore this unfortunate situation," said the former Ferrari driver.
His spokesman Sabine Kehm had told the BBC on Tuesday that although Schumacher - who was working as an advisor for Ferrari - was not willing to make a full-time return to F1, he would not rule out standing in for Massa.
And the German racing legend has now decided to come out of retirement and make a sensational return to the sport.
"It is true that the Formula 1 chapter has long been closed for me," said Schumacher, who won five world titles for Ferrari.
"The most important thing first: thank God, all news concerning Felipe is positive, and I wish him all the best again.
"This afternoon I met with team principal Stefano Domenicali and Ferrari president Luca di Montezemolo and together we decided that I will prepare myself to take the place of Felipe. "As the competitor I am, I also very much look forward to facing this challenge."
Schumacher has not driven an F1 car since April 2008 and competed in the last of his 249 grands prix in October 2006.
And the most successful F1 driver of all time now has slightly more than three weeks to prepare himself for the European Grand Prix in Valencia.
The ban on in-season testing means Schumacher will not be able to turn a wheel of the 2009 specification Ferrari before first practice on Friday 21 August.
Nevertheless, the team have chosen Schumacher - who won 91 grands prix in a glittering career - ahead of reserve drivers Marc Gene and Luca Badoer.
"Ferrari intends to entrust Michael Schumacher with Felipe Massa's car for as long as the Brazilian driver is not able to race," read a team statement.
"Michael Schumacher has shown his willingness and in the next few days he will undergo a specific programme of preparation at the end of which it will be possible to confirm his participation in the championship starting with the European Grand Prix."
There are six more races to go after Valencia, including trips to Belgium, Italy, Singapore and Japan. Schumacher will undergo an intensive training programme to determine whether he is fit enough to return to the rigours of F1 racing.
Since retiring from the sport, Schumacher has occasionally taken part in motorcycle events but in February he suffered neck and back injuries in a bike accident.
Those injuries could affect his ability to drive an F1 car which places huge pressures on the neck because of the varying G-forces.
Massa could be out for the rest of the season after undergoing surgery on a fractured skull sustained when a spring from Rubens Barrichello's Brawn hit him on the helmet when he was travelling at more than 160mph during qualifying in Hungary on Saturday.
The Brazilian is set to leave intensive care and is making progress, though there is also concern about damage to his left eye.
Schumacher is close to Massa, who was his team-mate in his final season, and has taken a close interest in the Brazilian's career.
BBC Radio 5 Live F1 commentator David Croft believes Schumacher is coming back partly because of that close relationship. "I think he's coming back because it is to replace Felipe Massa, temporarily. He is very close to Felipe, they've had a great relationship over the years," said Croft.
"I think it's his way of doing something to help Felipe, and doing something to help Ferrari at the same time, because if you look at the alternatives Ferrari had, they weren't really alternatives.
"Who else is there who could come into Ferrari and hit the ground running, who knows the car, who knows the team, who could give them a podium?
"The European Grand Prix, which was not one we were looking forward to at the start of this year, has now got a real spice to it.
"Lewis Hamilton against Michael Schumacher for the first time ever? Jenson Button up against Michael Schumacher? How will Kimi Raikkonen respond? It's going to be fascinating."