Eljif Elmas scored twice as Napoli earned a spot in the play-offs for the Europa League last 16 with a 3-2 win over Leicester City, who fall into the Europa Conference League.

Leicester travelled to Naples knowing they would guarantee a top-two finish in Group C if they could avoid defeat, but first-half strikes from Adam Ounas and Elmas put the hosts ahead on Thursday.

Jonny Evans and Kiernan Dewsbury-Hall quickly restored parity in a chaotic opening 45 minutes, only for Elmas to net again after the break and decisively edge Napoli back in front.

Luciano Spalletti's side settled for second – with Spartak Moscow defeating Legia Warsaw, following a 98th-minute penalty save, to top the group – and go into a two-legged play-off in February, while the third-placed visitors face a tie at the same stage of the Europa Conference League.

In a frantic start, Mario Rui's goal-line clearance denied Timothy Castagne following Dewsbury-Hall's cutback, before Napoli went up the other end and Ounas finished into the bottom-left corner after just four minutes.

Napoli doubled their lead when Andrea Petagna unselfishly squared for Elmas to tap in, but Evans quickly responded by firing past Alex Meret after James Maddison's free-kick was deflected towards him.

And Leicester were soon level as Dewsbury-Hall expertly volleyed into the bottom-right corner from the edge of the area.

Kasper Schmeichel pushed away from Ounas after the break, but the Denmark international was powerless when Elmas steered in to restore Napoli's advantage.

Maddison then spurned a glorious chance as he cannoned onto the post following Giovanni Di Lorenzo's mistake, and Jamie Vardy headed over in stoppage time after Schmeichel's save from Kevin Malcuit had kept Leicester's hopes alive.