Edinson Cavani converted a 93rd-minute penalty to consign AIK to defeat in their farewell match at the Råsundastadion and book ten-man SSC Napoli's place in the UEFA Europa League round of 32 with a game to spare.
The final fixture at Sweden's former national arena threatened to turn into an anti-climax for AIK when they fell behind to Blerim Dzemaili's first-half strike. While Andreas Alm's men levelled the Group F encounter a quarter of an hour later through Helgi Daníelsson, the Azzurri, who had Salvatore Aronica dismissed in the 85th minute, eliminated their opponents in added time following Per Karlsson's foul on Cavani.
A choreographed display of flag-waving supporters greeted the teams onto the pitch, an atmosphere Napoli quelled with their 20th-minute opener. As has often been the case this season, Cavani proved Napoli's go-to man, receiving Dzemaili's pass on the left. Several rangy strides later and after his low effort had been repelled by the legs of goalkeeper Ivan Turina, Dzemaili, who had carried on his run, volleyed in the rebound.
The Italian team were let off when Mohamed Bangura, capitalising on Aronica's mis-kick, fired into the side netting, yet AIK were not so forgiving nine minutes later as the unmarked Daníelsson directed Viktor Lundberg's right-wing cross over goalkeeper Antonio Rosati.
Cavani threatened to restore Napoli's advantage at the beginning of the second period, running onto Martin Lorentzson's miscued clearance and rifling across goal, before failing to reach substitute Gökhan Inler's cross-cum-shot.
The Uruguay striker was again the Allsvenskan club's tormentor-in-chief soon after, curling in a centre which hit Turina, who denied Eduardo Vargas on the follow-up. Bangura rifled over at the other end and was then fouled by Aronica as he attempted to burst through on goal. Cavani, though, had the last word, going down in the record books as the last scorer at the famous Stockholm venue.