Slovenia won a dramatic Group E showdown against the Czech Republic at the U18 European Championship for Men Division B on Friday, to set up a semi-final against Slovakia.
Poland will play the Czechs in the other semi-final game.
Mirza Sarajlija's lay-up with nine seconds remaining put the Slovenians into a 78-77 lead.
Jakub Kudlácek had a chance to put the Czechs back on top but missed a lay-up with one second remaining.
Dino Muric poured in 16 points, grabbed nine rebounds and handed out five assists for the Slovenians.
Tomás Satoránský had a game-high 18 and 11 rebounds in defeat.
The other game in the group on Friday also ended in thrilling fashion with Austria scraping a 71-69 victory over Sweden.
Sebastian Schaal's lay-up at the buzzer lifted Austria, who got 19 points, eight rebounds and four assists from Rasid Mahalbasic.
Slovenia topped the group at 3-0 followed by the Czech Republic (2-1) and Austria (2-1) with Sweden (0-4) fourth.
In Group F, Denmark brought Portugal back down to earth and deprived them of a semi-final spot with a 64-60 victory over the Iberian team just 24 hours after they had upset Slovakia.
Mads Frandsen shone with 12 points and 17 rebounds for the Danes.
The Slovakians slipped to another defeat, falling to Poland 91-74 but qualified from the three-team tie with Denmark and Portugal on the basis of their first round rout of the Danes.
Poland topped the group at 3-0 ahead of the Slovakians, Portuguese and Denmark, were all 1-2.