Cristiano Ronaldo scored his 700th career goal but it was not enough as Ukraine beat Portugal 2-1 in Kiev to book a place in the Euro 2020 finals, leaving its opponent with work to do if it is to qualify.
The host needed just a point in Monday's qualifier to secure a top-two finish in Group B, but picked up all three as it inflicted a first defeat in 14 games on the reigning European champion.
First-half strikes from Roman Yaremchuk and Andriy Yarmolenko earned victory for Andriy Shevchenko's side, who held on with 10 men after Taras Stepanenko was shown a second yellow card for handling the ball inside the box.
Ronaldo scored the resulting penalty 72 minutes in to bring up his personal landmark, but Portugal could not find a leveller and may now need victories over Lithuania and Luxembourg in its final two matches to hold off third-placed Serbia.
The group's top two entered the match in fine form but it was Ukraine who settled the better, opening up a two-goal lead inside 27 minutes.
Yaremchuk converted from close range after Rui Patricio parried Sergey Krivtsov's header six minutes in and Yarmolenko added a second before the half-hour mark, the West Ham midfielder getting between two defenders to convert Vitalii Mykolenko's cross.
Santos brought on Joao Felix at half-time and Portugal looked brighter after the break, with Ronaldo forcing Andriy Pyatov into a couple of fine saves inside seven minutes of the restart.
Ronaldo did pull one back from the spot after Stepanenko was adjudged to have handled the ball and the visitors nearly snatched a point at the death - Danilo Pereira's strike crashing back off the crossbar in added time.
What does it mean? Ukraine qualify, Portugal made to wait
Ukraine can look forward to another major tournament next year after securing a place in the finals with a game - away to Serbia - to spare.
As for Portugal, it is one point better off than third-place Serbia - 2-1 winners in Lithuania on Monday - and will likely have to win its remaining two fixtures if it is to automatically qualify.
Ronaldo brings up 700th goal
Having been denied by a couple of impressive saves from Pyatov early in the second half, it looked like being a day of frustration for Ronaldo.
His big moment arrived 18 minutes from time, though, as he successfully converted the penalty to make it 700 goals in what has been an incredible career.
Santos' big call backfires
Portugal boss Fernando Santos surprisingly named teenage forward Joao Felix on the bench and Portugal lacked any real attacking quality before his introduction at half-time.
Goncalo Guedes was the fall guy, being taken off after a disappointing 45 minutes that saw him touch the ball just 32 times.
Ukraine plays Estonia in a friendly a month today and concludes its qualifying campaign with a trip to Serbia three days later. Portugal hosts Lithuania and travels to Luxembourg in its final two qualifying matches.