Captain Fred hits four to keep Flu afloat
With three matches to go, third-placed Fluminense are five points behind Corinthians, who beat relegation candidates Ceara 1-0 away to take sole possession of first place with 64 points.
Vasco da Gama slipped two points behind Corinthians after a 1-1 draw away to Luiz Felipe Scolari's mid-table Palmeiras.
Fluminense appeared to have kissed goodbye to their title after last weekend's shock home defeat by 19-placed America-MG and when defender Rafael Marques put Gremio ahead in the 16th minute at the Engenhao in Rio their prospects looked worse.
However, with former Barcelona, Chelsea and Portugal midfielder Deco pulling the strings and Brazil striker Fred lethal up front, "Flu" fought back for an emotional 11th victory in 16 matches.
They were 2-1 down at half-time when Marquinhos scored with a 45th-minute free-kick after former Olympique Lyon striker Fred had equalised.
After a second goal from Fred, another by former Brazil striker Rafael Sobis put Fluminense ahead for the first time in the match just past the hour.
Burly striker Brandao made it 3-3 with 20 minutes to go in an open match with little marking and a lot of room to attack and a minute later midfielder Adilson put Gremio back in front with a lovely shot from outside the box.
Fred had the last words, though, scoring twice more in the space of three minutes, his third goal a penalty, to settle the match with nine minutes remaining.
Gremio had former Shakhtar Donetsk striker Brandao, who is on loan from Olympique Marseille, sent off soon after.
Corinthians, who had some help from arch-rivals Palmeiras since Scolari's team deprived their chief title rivals Vasco of two points, only secured their victory with Peruvian substitute Luis Ramirez's solo goal four minutes from time.
America continued their remarkable fight against relegation with a third successive victory against a team from the top five, beating Botafogo 2-1 at the Alligator's Arena after their wins over Corinthians and Fluminense.
The team from Belo Horizonte, promoted this year, had only won four of their previous 32 matches.