Emmanuel Eboue and Julio Baptista scored in the last seven minutes as Arsenal fought back from a goal down to top Champions League Group G.
Van Persie races through to coolly slot in Arsenal's equaliser
Rafael van der Vaart's spectacular shot gave Hamburg a shock early lead.
But Robin van Persie's cool finish from a fine first-time Cesc Fabregas pass drew the Gunners level after the break.
Alexander Hleb and Fabregas both saw shots crash off the crossbar but Eboue put Arsenal ahead from a tight angle and Baptista's late header sealed it.
The Germans should have been cannon fodder for the Gunners, having already been knocked out of Europe with a record of played four, lost four in this year's Champions League.
But within four minutes, Van der Vaart's sublime strike changed the thinking at the Emirates.
The Dutchman dummied two defenders and crashed a superb 25-yard right-foot strike past a bewildered Jens Lehmann and in off the underside of the bar.
Arsenal's hopes of a comfortable evening were in tatters but they refused to panic and were soon dominating possession and looking dangerous - although clear-cut chances were at a premium.
Full-backs Eboue and Gael Clichy seemed the most likely source of a goal, enjoying plenty of the ball in attacking areas.
But the massed ranks of visiting defenders held firm and could have snatched a second on the break when Mehdi Mahdavikia saw his shot deflected over by Philippe Senderos.
The Gunners' best chance of the half saw Hleb skip past a couple of defenders, swap passes with Fabregas, skip inside another attempted tackle and smash his shot off the bar from 12 yards.
The impressive Van Persie then sent a stinging free-kick fractionally over the bar with keeper Stefan Wachter beaten.
Van der Vaart celebrates his stunning 25-yard opener
Thierry Henry went equally close soon after the restart from another free-kick, his curled effort going agonisingly wide.
But the home fans had something to cheer when Van Persie coolly pulled the Gunners level on 52 minutes.
Hleb found Fabregas, the Spaniard slid the ball into Van Persie on the right flank and Van Persie duly drew the keeper and slid the ball into the gap at the near post.
It was then a matter of when and not if Arsenal would take the lead.
Henry, who picked up his third booking and misses the final game in Porto next month, saw a half-volley easily saved by Wachter and Fabregas' 30-yard shot came back off the bar.
But Arsene Wenger's men were not to be denied and the late introduction of Theo Walcott proved a masterstroke.
The England man found Eboue, whose fierce near-post shot squirmed through Wachter.
And moments later Walcott's inviting cross was gleefully headed home by substitute Baptista.
The Gunners now head to Porto in the final Group G game in two weeks knowing a draw will be enough to take them through - but they will have to secure their qualification without their skipper Henry.
Arsenal: Lehmann, Eboue, Toure, Senderos, Clichy, Hleb (Julio Baptista 81), Fabregas, Flamini, Van Persie (Adebayor 70), Ljungberg (Walcott 75), Henry.
Subs Not Used: Almunia, Silva, Djourou, Hoyte.
Booked: Senderos, Hleb, Henry, Clichy.
Goals: Van Persie 52, Eboue 83, Julio Baptista 88.
Hamburg: Wachter, Benjamin, Reinhardt, Mathijsen, Atouba (Ljuboja 67), Mahdavikia (Feilhaber 45), Wicky (Lauth 87), Van der Vaart, Fillinger, Trochowski, Sanogo.
Subs Not Used: Kirschstein, Jarolim, Berisha, Laas.
Booked: Benjamin, Van der Vaart, Sanogo, Fillinger.
Goals: Van der Vaart 4.
Ref: Claus Bo Larsen (Denmark).