London: Felipe Massa will stay at Ferrari for the 2013 season in an unchanged line-up with Fernando Alonso, the Italian Formula One team said in a statement on Tuesday.
The Brazilian has struggled for form in recent years but has agreed a one-year extension amid continued speculation that world champion Sebastian Vettel could join Alonso at Ferrari from 2014.
Alonso's contract runs to the end of 2016.
Massa's future has been the subject of speculation all season, with the 31-year-old suffering an abject run until he finished second at this month's Japanese Grand Prix for his first podium finish since 2010.
The Sao Paulo driver was fourth in South Korea on Sunday, round 16 of the championship, a result that meant he had scored more points in his last two races than he had in the first 11 of the season.
Ferrari's decision was not a great surprise, with Alonso clearly favouring the Brazilian as his team mate having established himself as the clear focus of the sport's most successful team.
Massa's poor form in the first half of the campaign has hit Ferrari hard in the constructor's championship, however, where they are currently second to Red Bull but still 77 points off the lead.
Double champion Alonso has scored 209 of those points and Massa's fate was determined after a meeting with Ferrari president Luca di Montezemolo at the Maranello factory on Tuesday.
Montezemolo said on Monday that Massa, who suffered near fatal head injuries when hit by a bouncing spring in qualifying for the 2009 Hungarian Grand Prix, had returned to the level expected of him.
He had also said, referring to the Vettel speculation, that he did not want to have "two roosters in the same hen house" but rather two drivers "who race for Ferrari and not for themselves."
The decision will be a blow for those who had been touted as possible replacements at the most glamorous team in the sport, notably the Force India pair of Briton Paul Di Resta and Germany's Nico Hulkenberg.
Seven times world champion and Ferrari great Michael Schumacher has already announced his retirement at the end of the season and was not an option, even if some diehard supporters hoped he could be.
The attention will now turn to the Swiss Sauber team who have at least one vacancy, with Mexican Sergio Perez leaving to join McLaren as the replacement for Mercedes-bound Lewis Hamilton, and possibly two if Japan's Kamui Kobayashi is not retained.
Hulkenberg is considered a hot favourite to take one of those places.
Massa has been a part of the Ferrari family all of his Formula One career, starting at Ferrari-powered Sauber and also serving as a Ferrari tester before joining as a race driver in 2006 and staying on after Schumacher decided to retire.
He was runner-up in the 2008 championship to Hamilton by a single point and has won 11 grands prix with his last coming in Brazil at the end of 2008.