( CNN ) -- Serbia are through to the semifinals of the world basketball championships in Istanbul after a narrow 92-89 victory over holders and European champions Spain on Wednesday . In a repeat of last year 's European final , Serbia gained their revenge when a Milos Teodosic three-pointer with just three seconds remaining secured a thrilling win . Serbia had the upper hand for most of the match , leading by four points at the end of the first quarter and eight points at half-time . Spain rallied in the third quarter and at one stage nine unanswered points saw them take the lead in a see-saw session . However , the period ended with Serbia three points to the good and they held an advantage until 28 seconds from time when Marc Gasol of NBA side Memphis Grizzlies levelled the score . But with Serbia in possession , Milos Teodosic , who plays for Greek side Olympiakos , let the clock run low before unleashing a three-pointer to put his side back in front with just 3.1 seconds remaining . The result means Spain have failed to reach the semifinals of a major tournament for the first time since the 2004 Athens Olympics . Meanwhile , host nation Turkey continued their march in the competition , reaching the last four with a comfortable 95-68 success over Slovenia .
qualified through to the finals of the world basketball championships . They recorded a 92 - 87 victory over host and European champions Spain . A late Milos Teodosic three - pointer secured a surprise victory for Serbia . The result was revenge for Spain 's win over Serbia in the 2009 European final .