The Brazilian edged out Kimi Raikkonen's Lotus by just 0.006 seconds in a very tight end to the hour.
By the time the medium-tyre qualifying simulations were completed, just 0.353s covered the Ferraris, Lotuses and Red Bulls.
As had been the case on Friday, local hero Fernando Alonso spent plenty of time at the head of the order in the #3 Ferrari.
Early quick times from the Mercedes, Sebastian Vettel and the Lotus pair were deposed when Alonso set a 1m23.006s after 24 minutes.
The lap was far from perfect, but it was enough to edge a few fractions in front of Romain Grosjean and Raikkonen.
Alonso's time was the quickest of the hard-tyre runs, and when the qualifying simulations on mediums began, he was first to raise the bar with a 1m22.254s.
Raikkonen then hinted that Lotus might have the one-lap pace to be a qualifying factor as he beat Alonso's time by 0.347s 10 minutes from the end.
The only man able to beat this was Massa, who slipped in a 1m21.901s to secure the top spot.
Mark Webber ended up as Red Bull's lead runner in third, followed by Grosjean and Vettel.
Alonso was eventually pushed down to sixth.
The Force Indias of Paul di Resta and Adrian Sutil took seventh and eighth.
Mercedes worked hard on long runs, Lewis Hamilton and Nico Rosberg completing more laps than anyone else.
They ended up ninth and 11th, split by another impressive run from Toro Rosso as Jean-Eric Vergne made the top 10.
McLaren continued to struggle. Jenson Button and Sergio Perez were only 12th and 14th in the heavily revised car.