Spain erased an eight-point deficit in the final 4 minutes to tie it on Marc Gasol's basket with 25 seconds remaining. After a timeout, Serbia patiently ran its offense until Teodosic — 1 of 7 on 3-pointers at that point — pulled up from straightaway, well beyond the arc.
"He's a great player and he has a great feeling for the big shot," Spain coach Sergio Scariolo said.
The Spaniards couldn't get a final shot off, with Jorge Garbajosa losing the ball after a timeout. Serbia's players celebrated at midcourt as Spain's Sergio Llull kicked the ball deep into the stands.
"I think it was a very, very tough game. Maybe the best one until now in Istanbul," Serbia coach Dusan Ivkovic said.
"It's very difficult to forget this kind of game, but we have to try to forget everything that happened tonight because in two days we will play in the semifinals," Teodosic said.
Marko Keselj and Novica Velickovic scored 17 points apiece for Serbia, while Dusko Savanovic added 15. The Serbians were 15 of 30 from 3-point range, exploiting the zone seemingly every time Spain used it.
"We were not able to stop them on the long shots," Spain guard Juan Carlos Navarro said. "That's why we lost and I believe that's why they deserved to win."
Navarro scored 27 points and Garbajosa, the former Toronto Raptors forward who recovered from a severe leg injury, added 18.
But the Spaniards, considered the co-favorites along with the United States coming into the tournament, lost for the third time in Turkey. They were without their best player, Lakers All-Star Pau Gasol, then lost point guard Jose Calderon of the Raptors shortly before the tournament.
The champions in Japan four years ago now will be forced to qualify for the 2012 Olympics at next year's European championship.
Teodosic, one of the two Serbia players suspended for a brawl in an exhibition game against Greece, finished with 12 points. Center Nenad Krstic of the Oklahoma City Thunder, the other suspended Serb, finished with 13 points and nine rebounds.