Xavier Rabaseda scored 23 points and Mamadou Samb had 18 points, 13 rebounds and two blocks as Spain beat France 84-76 for France's first defeat at the U20 European Championship.
Jorge Fernandez scored 13 points and Pablo Aguilar hit for eight points in his first action for Spain, who drew even with France at 4-1 atop the qualifying round Group E.
Antoine Diot paced the French with 15 points and seven rebounds while Carl Ona-Embo and Edwin Jackson both scored 14 points and Kevin Seraphin had 11 points and seven rebounds.
One day after missing two free throws with two seconds left and a chance to tie the game against Greece, Rabaseda scored ten points in leading Spain to 13-5 early lead. Sergio De La Fuente's three-point play made it 18-10 for Gustavo Aranzana's team and Samb's three-pointer at the buzzer gave Spain a 24-18 lead after one period.
Fernandez and Luis Parejo nailed back-to-back three-pointers to push the cushion to 12 points - 36-24. Fernandez scored six more points to keep Spain comfortably ahead and the lead was 44-32 at intermission.
In the third period, Aguilar hit a three-ball and Samb converted a three-point play to increase the advantage to 52-34. And Pablo Almazan and Rabaseda followed later with back-to-back triples for a 62-41 Spain advantage.
But LamineSambe and Ona-Embo each nailed long balls in a 10-0 France answer to bring Jean-Aymi Toupane's team within 62-51 after three periods.
The French could only slowly chip into the Spanish lead and Jackson's triple cut the gap to 82-76 with 42 seconds to play. But Samb converted a tip-in with 23 seconds left and then France turned over the ball to decide the game.