Olympiacos secured their place in the Champions League play-offs with victory at Ajax.
The Greek side, who needed three points to secure their berth, finished 18th in the league phase.
After a goalless first half the shackles came off and it was Gelson Martins who struck first with a stunning solo effort to put Olympiacos into the lead.
Ajax responded 17 minutes later with a controversial penalty given for a Christos Mouzakitis handball. Kasper Dolberg took the spot-kick and slotted past Konstantinos Tzolakis.
With a point not looking likely to be good enough to send the Greek side through, Santiago Hezze rose highest from a corner to nod Olympiacos back into the lead.
Olympiacos will play Atalanta or Bayer Leverkusen for a place in the last 16, with the draw for February's play-offs taking place on Friday.
Player of the match
After the opportunity to rate players has closed, the score displayed represents the average from all the submissions by BBC Sport users.
Watch highlights of every Champions League game from 22:00 on Wednesday on BBC iPlayer and the BBC Sport website and app.
There will also be a Champions League Match of the Day on BBC One on Wednesday, from 22:40 to 00:00.
