While the Spaniards struggled with their shooting early on, Slovenia had the hot hand in the first half, hitting 10 of 15 from beyond the arc to go into the break with a four-point lead, 49-45.
With both sides coming into the game off the back of seven successive Eurobasket victories, a close contest was expected, but Slovenia blew the Spaniards away in the second half.
The underdogs led by 19 early in the fourth quarter, despite the influential Goran Dragic spending much of the third period on the bench.
At the other end of the floor Slovenia’s defense smothered the Spanish attack, switching quickly and pressuring shooters, regardless of whether they were on the perimeter or driving to the basket.
With Dragic back in the game, Slovenia kept their lead as Spain, led by veteran brothers Pau and Marc Gasol, repeatedly missed shots on offence and were caught flat-footed on defense.
Dragic and American-born Anthony Randolph topped the scoring charts for Slovenia, netting 15 points each, with Randolph a perfect three-for-three from outside the arc.
In another superb display, Slovenia’s teenage point guard Luka Doncic notched up 11 points, as well as chipping in with eight assists.
Serbia and Russia face off in the second semi-final on Friday.