Portugal upset Poland after overtime in a thrilling EuroBasket qualifier in Coimbra.
The hosts came into the game on the back of five straight defeats but emerged from a tense finish to put a halt to Poland's growing momentum.
Portugal had led for much of the game, but looked to have blown it when they allowed Poland to come back in the third quarter and pull ahead.
The visitors had a 53-49 lead with 8:48 to go on Dardan Berisha's three-pointer, but Portugal came back to tie it 53-53 on Heshimu Evans' free throws.
The teams exchanged baskets but from 57-56 down with six minutes to go Portugal went on a 10-2 run, capped by Carlos Andrade's three, to take a 66-59 lead.
However, Poland were not done yet and slowly chipped away at the lead.
It looked like their chance had drifted away when Miguel Miranda went to the line with 40 seconds left to put Portugal seven in front, 72-65, before Maciej Lampe made one from deep for Poland with 27 ticks left.
Miguel Minhava added one for Portugal from the line, but Thomas Kelati then hit a pair and, after Miranda came up empty with two free throws, Lukasz Koszarek nailed a three-pointer for Poland that made it a one-point game, 74-73, with five seconds left.
Andrade went to the line for Portugal, but could only make one and that allowed Berisha to tie it with a buzzer-beating jump-shot.
Portugal got the first four points of the extra stanza as Poland's shooting deserted them and Andrade blocked Koszarek's effort.
But Marcin Gortat's jump-shot was followed by another from Berisha, who drew a foul in the process and put Poland on top 80-79 from the free-throw line.
Miranda responded with a three and Minhava's jump-shot made it 84-80 with 90 seconds to go.
Lampe's jumper cut the gap to two and after Minhava's shot missed Kelati tied the game from the free-throw line, 84-84, with 15 seconds left.
However, they could not get a foul in quickly and there was only one second left on the clock when David Gomes went to the line to make one of his two free thows and leave Poland no time to respond.
Evans led Portugal with 20 points while Miranda had 19 and Andrade 15.
Koszarek and Lampe each had 19 points for Poland while Gortat added 18.