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.
"The team and also all the fans can rest assured that I will do all in my power to help the Scuderia reach the targets it sets itself each year," Massa said on the Ferrari website.
Massa's future has been uncertain 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.
"I am so happy to continue another year with @Felipe1Massa as a teammate! I'm sure we are the best team! #ForzaFerrari," Alonso said on Twitter after an announcement that Ferrari said they had planned to make next week but had brought forward to end all the speculation.
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 Ferrari's 290 points and Massa's fate was determined after a meeting, described by the team as very friendly, with Ferrari president Luca di Montezemolo at the Maranello factory on Tuesday.
Montezemolo had 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 for a decade, starting at Ferrari-powered Sauber in 2002 and also serving as a Ferrari tester before joining as a race driver in 2006 and staying on after Schumacher's first retirement.
"Ferrari is my racing family and throughout my entire time in Formula One, I have always driven cars powered by engines built in Maranello: I can't see myself driving cars propelled by anything else," he said on Tuesday.
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.
"We have always supported Felipe, even in the most difficult moments of his career and we are certain of his worth and are sure he will know how to repay the confidence this renewal proves we have in him," said team principal Stefano Domenicali.