Match ends, Napoli 2, Lazio 4.
Napoli 2-4 Lazio
Rafael Benitez's last game in charge of Napoli ended in a dramatic defeat to Lazio which cost his side the chance of qualification for the Champions League.
Benitez, who is expected to become the new manager of Real Madrid, needed a win to take Napoli above their opponents to finish third in Serie A.
From 2-0 down at half-time, Gonzalo Higuain scored twice in a thrilling fightback but then missed a penalty.
Substitutes Ogenyi Onazi and Miroslav Klose then scored as Lazio won it.
Both sides finished a remarkable game with 10 men as Napoli ended the season in fifth place after Fiorentina beat Chievo 3-0.
Lazio's Marco Parolo was sent off for a second yellow card in the second half after he had given the visitors a 33rd-minute lead with a deflected long-range shot.
They added to their advantage in first-half stoppage time thanks to Antonio Candreva's calm finish when sent clear with just goalkeeper Mariano Andujar to beat.
Higuain then scored both of Napoli's goals in a thrilling start to the second half which promised to give Benitez a memorable send-off, with Napoli knowing that a win would take them above Lazio thanks to their better head-to-head record.
First the Argentina international, 27, side-footed home to make it 2-1.
He then fired his 28th goal of the season into the bottom corner from a Dries Mertens pass.
Napoli defender Faouzi Ghoulam was dismissed for a second caution with 20 minutes to go.
And with just 15 minutes left, Senad Lulic tripped Christian Maggio to concede a penalty, but Higuain extended his poor record on spot-kicks this season when he fired the ball over to record his fourth miss from seven attempts.
Lazio then secured their place in the Champions League for the first time since 2008 with two late goals.
Onazi scored less than two minutes after being sent on by manager Stefano Pioli and veteran German international Klose, 36, headed home his 15th goal of the season in the last minute.
Elsewhere, Sampdoria drew 2-2 with Parma to guarantee finishing above Inter Milan - who beat Empoli 4-3 - and finish seventh.
That will be enough to earn them Italy's final place in the Europa League if Genoa fail in their appeal against a decision by the Italian Football Federation not to grant them a Uefa licence to compete in next season's competition, owing to an administration issue.
- 45AndujarBooked at 86mins
- 31GhoulamBooked at 70mins
- 19López Silva
- 88InlerSubstituted forGabbiadiniat 53'minutes
- 7CallejónSubstituted forZapataat 89'minutes
- 14MertensSubstituted forInsigneat 77'minutes
- 8Frello Filho
- 33Dos Santos NascimentoBooked at 43mins
- 3de Vrij
- 16ParoloBooked at 62mins
- 32CataldiSubstituted forOnaziat 84'minutes
- 19LulicBooked at 76mins
- 87CandrevaBooked at 88mins
- 9DjordjevicBooked at 19minsSubstituted forKloseat 78'minutes
- 7Pereira GomesSubstituted forLedesmaat 65'minutes
- 14Balde Diao
- Gianluca Rocchi
- Shots on Target
Second Half ends, Napoli 2, Lazio 4.
Foul by Christian Maggio (Napoli).
Miroslav Klose (Lazio) wins a free kick on the left wing.
Corner, Napoli. Conceded by Mauricio.
Goal! Napoli 2, Lazio 4. Miroslav Klose (Lazio) header from the centre of the box to the bottom left corner. Assisted by Cristian Ledesma with a cross following a set piece situation.
Foul by Manolo Gabbiadini (Napoli).
Cristian Ledesma (Lazio) wins a free kick on the right wing.
Attempt saved. Dusan Basta (Lazio) right footed shot from a difficult angle on the right is saved in the centre of the goal. Assisted by Antonio Candreva with a through ball.
Substitution, Napoli. Duván Zapata replaces José Callejón.
Foul by Lorenzo Insigne (Napoli).
Dusan Basta (Lazio) wins a free kick in the defensive half.
Foul by Gonzalo Higuaín (Napoli).
Stefan de Vrij (Lazio) wins a free kick in the defensive half.
Antonio Candreva (Lazio) is shown the yellow card for a bad foul.
José Callejón (Napoli) wins a free kick in the defensive half.
Foul by Antonio Candreva (Lazio).
Foul by José Callejón (Napoli).
Antonio Candreva (Lazio) wins a free kick on the right wing.
Goal! Napoli 2, Lazio 3. Ogenyi Onazi (Lazio) right footed shot from the centre of the box to the bottom right corner following a fast break.
David López (Napoli) wins a free kick in the defensive half.
Foul by Miroslav Klose (Lazio).
Offside, Napoli. Raúl Albiol tries a through ball, but Lorenzo Insigne is caught offside.
Substitution, Lazio. Ogenyi Onazi replaces Danilo Cataldi.
Foul by Kalidou Koulibaly (Napoli).
Miroslav Klose (Lazio) wins a free kick in the defensive half.
Gonzalo Higuaín (Napoli) wins a free kick on the right wing.
Foul by Stefan de Vrij (Lazio).
Offside, Napoli. David López tries a through ball, but Gonzalo Higuaín is caught offside.
Attempt saved. Lorenzo Insigne (Napoli) right footed shot from the left side of the box is saved in the centre of the goal. Assisted by Marek Hamsik.
Substitution, Lazio. Miroslav Klose replaces Filip Djordjevic because of an injury.
Substitution, Napoli. Lorenzo Insigne replaces Dries Mertens.
Penalty missed! Bad penalty by Gonzalo Higuaín (Napoli) right footed shot is too high. Gonzalo Higuaín should be disappointed.
Senad Lulic (Lazio) is shown the yellow card for a bad foul.
Penalty Napoli. Christian Maggio draws a foul in the penalty area.
Penalty conceded by Senad Lulic (Lazio) after a foul in the penalty area.
Delay over. They are ready to continue.
Delay in match Cristian Ledesma (Lazio) because of an injury.
Second yellow card to Faouzi Ghoulam (Napoli) for a bad foul.
Foul by Faouzi Ghoulam (Napoli).