Stojanovic, who won two national league titles with NK Domzale before becoming an assistant to United Arab Emirates coach Srecko Katanec in 2009, will take charge for the first time in a home friendly against United States on November 15.
"We had a big dilemma who to appoint after we parted company with Kek [on Monday] and we opted for Stojanovic because we are convinced he is capable of guiding the team at the top level," Slovenian Football Federation president Aleksander Ceferin told a news conference.
"Stojanovic will be in charge for the duration of the 2014 World Cup qualifiers and his contract will be extended automatically for the rest of the tournament if we qualify for the finals in Brazil."
The 42-year-old started his coaching career in 1998, winning under-16 and under-18 Slovenian league titles with ND Slovan before he clinched successive senior championships with Domzale in 2007 and 2008.
Stojanovic then joined compatriot Katanec, who had steered Slovenia to Euro 2000 and the 2002 World Cup, at the United Arab Emirates and helped them qualify for this year's Asian Cup.
Slovenia failed to qualify for Euro 2012 under Kek after finishing fourth in their group behind Italy, Estonia and Serbia.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.