Title-contenders Spain were pushed all the way in a nervy 67-60 victory over Italy to squeeze into the Basketball World Cup quarter-finals on Friday -- and take strongly fancied Serbia with them.
Also into the last eight in China are surprise package Poland and Argentina after they overcame Russia and Venezuela respectively.
Rio 2016 Olympic bronze medallists Spain started sloppily in Wuhan against the Italians, in what was an occasionally testy second-round affair.
The two teams were level 18-18 after the first quarter, only for the Italians to edge ahead by a single point at half-time.
Spain, ranked second in the world behind world and Olympic champions the United States, were a different proposition for most of the third quarter, but saw their initial decent advantage narrowed to just two points going into the fourth.
Italy, ranked 13th, were the underdogs but they refused to relent and tied the game at 50-50 with a lay-up by Marco Belinelli of NBA team San Antonio Spurs.
The Italians streaked into a four-point lead with four minutes left, as the pressure cranked up another notch.
But Spain and Ricky Rubio were not done, the Phoenix Suns guard getting the freedom of the court to edge ahead by two points once more.
The 28-year-old Rubio was increasingly influential and he made two free throws to give Spain a precious 60-56 lead that they would not let go.
Earlier, Denver Nuggets All-Star Nikola Jokic pulled the strings as formidable Serbia demolished Puerto Rico 90-47 to stand on the brink of the last eight.
Spain's hard-won victory later in the day was enough to send the impressive Serbs through but the two countries will still play on Sunday in a mouthwatering match-up for supremacy of the group.
Jokic had 14 points and 10 rebounds, and made a sublime laser pass to cut open the Puerto Rico defence, as Serbia began the second-round group phase much as they finished the first.
Sacramento Kings forward Nemanja Bjelica also impressed once more, drilling a leading 18 points.
World and Olympic silver medallists Serbia are in devastating form, comfortably winning all four matches in China and claiming the unofficial title of favourites from holders the United States.