Scariolo, who also coaches struggling Italian club side Emporio Armani Milan, took over the Spanish national team in 2009, leading a squad including brothers Pau and Marc Gasol to back-to-back Eurobasket triumphs.
They won silver at the London Olympics in Scariolo's last major competition in charge, losing to the United States in the gold medal match in a repeat of the 2008 final in Beijing.
"After a long and difficult evaluation I have decided to leave the Spanish national team," Italian Scariolo said on his personal website.
"This decision is motivated by the desire to devote more time to my family after four very intense years," added the 51-year-old.
"A difficult decision because of the quality of personal relationships and the results achieved, but also for the perspective of continuing the streak of successes in the coming years."
Scariolo said farewell at a news conference in Madrid on Wednesday, where FEB president Jose Luis Saez announced that Spaniard Orenga would be taking over.
"I have decided that the next coach will be Juan Antonio Orenga," Saez said after paying an emotional tribute to Scariolo.
"He (Orenga) represented Spain 128 times as a player, he has worked with the youth teams, with the Under-20 side, and he has been with the senior squad for five years," he added.
"I think it was the right time to go for continuity and bet on the existing structures in the federation."
Scariolo's Emporio Armani face a key Euroleague away game at Spaniards Caja Laboral Vitoria on Thursday. They have three wins and four losses in their section and defeat would put them in danger of missing out on a top-16 berth.
"I wish the Spanish basketball federation a brilliant future in the short and medium terms ... there are all the ingredients to make this happen," Scariolo said.