Stuttgart hit back when 19-year-old Timo Gebhart beat three defenders and rifled his shot home on 80 minutes.
But with a 3-1 deficit to overcome from the first leg, Stuttgart were always struggling to have a realistic chance of making the next round.
Zenit made it 2-1 on the night after 85 minutes when Viktor Fayzulin smashed into the empty net.
Martin Jol’s Hamburg are also through after Croatia striker Ivica Olic struck as early as the ninth minute, his goal enough to seal a 1-0 win over NEC Nijmegen and a 4-0 aggregate success.
Draw for the last 16 of the UEFA Cup:
• Werder Bremen v St Etienne
• CSKA v Shakhtar Donetsk
• Udinese v Zenit St Petersburg
• Paris Saint-Germain v Braga
• Dynamo Kiev v Metalist Kharkov
• Manchester City v Aalborg
• Marseille v Ajax
• Hamburg v Galatasaray