The Spaniards had already secured their qualification for the knockout stages, but Victor Fayzulin’s last-minute goal gave Zenit a small chance to get through.
The visitors scored two goals in as many minutes to give them the lead at half-time, while Diego Buonanotte and Sebastian Fernandez scored early.
Danny scored a goal for the hosts at the start of the second half, before Fayzulin found four minutes from the end.