The win gave Serbia first place in Group E, with both teams having already qualified for the quarterfinals.
Earlier, Sacha Massot had a key block and a dunk late in the game to help give Belgium a 60-56 victory over Latvia that sent Ukraine into the quarterfinals.
Ukraine needed the help, too, as it then lost 70-63 to Lithuania in a later game. Latvia needed to win and have Lithuania beat Ukraine to advance.
"We beat Belgium by one point on a 3-point play with two seconds left in our first game of the tournament and they did us a favor today," Ukraine coach Mike Fratello said.
Ukraine joins France, Serbia and Lithuania in advancing from Group E. Croatia, Slovenia and Italy have already advanced from Group F, which ends play Monday.
Massot blocked a Janis Blums layup and then dunked for a 59-56 lead that completed a 9-0 Belgium run. Dairis Bertans missed a 3-point attempt and Wen Mukubu made one of two free throws to complete the scoring. Massa led Belgium with 14 points, four rebounds and three blocks.
Latvia, which shot 29 percent from the field, had a chance to win late despite trailing most of the game but Rolands Freimanis botched an alley-oop attempt. Latvia got the ball back thanks to Axel Hervelle's turnover but Massot blocked Blums' drive.
Latvia made only 5 of 29 3-point attempts despite relying on long-range shooting as its biggest weapon. Mukubu had 13 points and Hervelle added 10 and seven rebounds in Belgium's only second-round win.
Lithuania's Linas Kleiza nailed a 3-pointer for a decisive 67-63 lead with 1:03 remaining. He also made a free throw and Donatas Motiejunas made two as Lithuania scored the last six points of the game.
"They made the big shots when they had to," Fratello said, while praising his team for its effort even though it had already qualified before the game. "They could focus on trying to win to move up in the standings. It didn't happen but they showed they deserved to be here."
Kleiza finished with 15 points, while Sergii Gladyr had 18 for Ukraine. Pooh Jeter added 10 points and eight assists.
"We didn't expect to get this far, but we are young and ambitious and we go out and play hard," Gladyr said.
Ukraine, which will host the next European championship in two years, is in the quarterfinals for the first time.
"Ukraine has improved a lot, they play very good basketball," Lithuania coach Jonas Kazlaukas said.