Botafogo fell eight points back of leaders Cruzeiro over the weekend after suffering a 2-1 home defeat to Bahia.
Cruzeiro was held to a 0-0 draw at Corinthians on Sunday, which gave Botafogo the chance to close the gap on the first-place side.
And Edilson's goal on the half-hour mark put the hosts in front and held up until the final 10 minutes.
Fernandao leveled the contest nine minutes from time for Bahia and Obina tallied the winning goal four minutes later to hand his team an unlikely three points.
Botafogo now leads third-place Atletico PR by just one point after the team edged Ponte Preta, 1-0, behind a first-half goal from Paulo Baier.
Goias left it late against Sao Paulo in a 1-0 triumph as Rodrigo netted the lone goal in the 89th minute, Portuguesa downed 10-man Internacional 1-0 with a goal from Wanderson in the 85th minute, last-place Nautico earned a 0-0 draw with Flamengo, Atletico Mineiro scored twice in the first 20 minutes of a 2-1 win over Vasco da Gama and Santos got first-half goals from Thiago and Willian in a 2-1 victory against Criciuma.
Both matches on Saturday ended in draws as Vitoria and Gremio played out a 0-0 stalemate while Fluminense and Coritiba finished 1-1.