Late goals set Zenit on their way to a hard-fought win to stay in second, three points adrift of Spartak.
The late goals by Brazilian Giuliano and Russian international forward Alexander Kokorin set Saint Petersburg side on their way to a hard-fought win to stay in second, three points adrift of Spartak.
CSKA Moscow, who beat visitors Orenburg by the same scoreline, sit third, five points further back.
Zenit started in lively fashion but Ufa created the first chance of the match on the counter-attack in the 14th minute, when forward Vyacheslav Krotov forced 'keeper Yury Lodygin into a diving save with a volley.
The home team also had an opportunity to score in the 36th minute but former Chelsea winger Yury Zhirkov fired the ball over from just 10 yards out.
In the 84th minute skipper Axel Witsel found unmarked Giuliano in the area and the Brazilian lifted Zenit ahead with a close-range angled shot.
Kokorin added his goal in the third minute of stoppage time beating Ufa 'keeper Andrei Lunev with a low shot after the mazy run from within his own half.
Elsewhere, reigning champions CSKA Moscow pinned visitors Orenburg back from the kick-off and Israeli international Bebars Natcho put them in front with a spotkick in the 26th minute after Orenburg back Vladimir Poluyakhtov handballed in his area.
After the break Orenburg's hopes went up in smoke as captain Dmitry Andreyev was sent off for a second bookable offence.
With 11 minutes left, substitute back Sergei Ignashevich hammered home a low effort from 25 yards out to secure CSKA a well-deserved win.
"We had just one objective for this match -- to win -- and we managed to cope with it," CSKA head coach Leonid Slutsky said.