A mistake by Faouzi Chaouchi, Algeria's goalkeeper, handed Slovenia a 1-0 victory in their opening World Cup Group C match.
The match on Sunday took a sharp turn in Slovenia's favour after Chaouchi fumbled a harmless looking 79th minute shot from Robert Koren, Slovenia's captain.
The fumble allowed the ball to squirt through his arms into the bottom left hand corner of his net.
Algeria had been reduced to 10 men when substitute Abdelkader Ghezzal was sent off in the 73rd for handball having already been booked. He was only on the pitch for 15 minutes.
It was Slovenia's first win at a World Cup after their only previous appearance, in 2002, ended in three defeats.
They top Group C with three points, two ahead of England and the United States, who drew 1-1 in Rustenburg on Saturday.
The Algerians had been marginally the better side in a lacklustre encounter until then, with the bleach-blond Hassan Yebda bossing their midfield.
But they created few chances with their best opening having come as early as the third minute through a Nadir Belhadj free kick which Samir Handanovic tipped over the bar.
At the other end, Slovenia created little of note until just before the break when a rasping left foot strike from midfielder Valter Birsa forced an acrobatic save from Chaouchi.
Both teams appeared to struggle with the high-bouncing World Cup ball and time after time they over-hit their passes with the ball running harmlessly out of play.
England's draw with the US in the group's opening match also contained a goalkeeping error, with England's Robert Green producing a howler to gift the Americans their equaliser.