NAPLES, Italy — Vincent Aboubakar scored twice and Besiktas beat Napoli 3-2 in the Champions League on Wednesday to deny the Italian club a chance at advancing from the group stage in record time.

Aboubakar, a Cameroon international on loan from Porto, scored the winner four minutes from time after having also restored Besiktas’ lead late in the first half.

It was the Turkish side’s first win in the competition since 2009.

If Napoli had won and the other group match ended in a draw, it would have become the first team in Champions League history to advance from its group after just three matches.

Now, Napoli has just a one-point lead over Besiktas, with Benfica two points back after its 2-0 win at Dynamo Kiev.

“There was a series of episodes that could have really hurt a team but we always reacted well. So I consider this game a big step forward compared to the Roma match,” Napoli manager Maurizio Sarri said, referring to a home loss to Roma at the weekend. “Unfortunately it ended with a result that doesn’t reflect the course of the match.”

While Napoli missed injured center forward Arkadiusz Milik, the Partenopei were most lacking on defense.

Adriano scored on Besiktas’s first opportunity 12 minutes in, redirecting a low cross from Ricardo Quaresma that found its way through a crowded area.

Dries Mertens equalized for Napoli on the half-hour mark, finishing off a beautiful exchange that began with captain Marek Hamsik and ended with Jose Callejon cutting the ball the back for Mertens to prod home.

Eight minutes later, Besiktas took the lead again through Aboubakar, who took advantage of a dreadful back pass by Napoli midfielder Jorginho.

Besiktas goalkeeper Fabri made a diving save to stop a penalty from Lorenzo Insigne early in the second half and preserve the lead.

Napoli substitute Manolo Gabbiadini converted a penalty to make it 2-2 five minutes after he replaced Insigne. Fullback Caner Erkin was booked for tugging Mertens’ shirt in the area.

Aboubakar’s second came with a header following a free kick from Quaresma, although the striker may have been offside.

It was Napoli’s first home loss in the competition, having won eight and drawn four games stretching back to the old European Cup.

Napoli has also lost two straight in Serie A.