The two-time Formula One champion clocked 1 minute, 12.296 seconds with his Renault at the 2.6-mile Interlagos track, edging home-crowd favorite Massa of Ferrari by 0.057 seconds in the second practice session.
"Overall, the car performed well and is competitive," Alonso said. "I think we still have problems to solve in the car, which is not perfect, but I think we can solve them for tomorrow."
Hamilton enters the Brazilian GP with a comfortable lead over Massa and needs to finish fifth or better on Sunday to become F1's youngest champion at age 23. Alonso was 24 when he won the title in 2005.
Qualifying for the Brazilian GP is on Saturday for Sunday's last race of the season.
Jarno Trulli of Toyota had the third-fastest time of the day with 1:12.435, followed by championship leader Hamilton of McLaren with 1:12.495. Hamilton clocked 1:12.827 in the afternoon session, good only for ninth.
"The car felt good, especially this morning," Hamilton said. "I'm pretty comfortable that we have a good package."
Massa was quickest in the first session with a time of 1:12.305, edging Hamilton.
"For sure we are more competitive, and when you are more competitive there is more motivation," Massa said. "It was a good start."
Massa led most of the second session before Alonso clocked the fastest time in his last lap at the track where he won his drivers' titles in 2005 and 2006. Alonso was sixth in the morning session.
Both sessions took place under cloudy conditions, and light rain fell at times. The temperature was lower than usual for this time of the year in South America's biggest city at 62 degrees. Forecasters said it should get warmer during the weekend, but there is an 80 percent chance of rain during the race on Sunday.
Hamilton could clinch his first championship even without finishing the race, if Massa fails to cross the line in first or second. A win is worth 10 points, and second through eighth are 8-6-5-4-3-2-1.
The crowd got to their feet when Massa took to the track for the first time on Friday, and cheered nearly every time he went by. Brazilians haven't celebrated an F1 title since the late Ayrton Senna won the championship in 1991.
Massa won the race at his home track in 2006 -- becoming the first Brazilian to win at home since Senna in 1993 -- and was second last year after letting teammate Kimi Raikkonen go by so he could clinch the title over Hamilton.
Hamilton, trying to become the first British champion since Damon Hill in 1996, lost a chance at the title in his rookie season a year ago after blowing a seven-point lead. An early mistake and a subsequent gear box problem led to a seventh-place finish, and second overall in the drivers' standings.
Massa could become the first driver to win a title in front of his home crowd since the inaugural F1 season in 1950, when Italy's Giuseppe Farina won at the season-ending Italian GP. The Brazilian could also become the first non-European driver to win the title since Canada's Jacques Villeneuve in 1997.
Along with the drivers' title, Ferrari and McLaren are also fighting for the constructors' championship. The Italian team has an 11-point lead entering the weekend.