More can always be said but the below threads covers it in sufficient detail,
Why was Spain not involved in WWI and/or WWII? by u/Georgy_K_Zhukov
How involved was Spain in WW2, and why did they never escalate into full scale involvement? by u/strangechicken and u/rosaluxificate
Why did Europe tolerate Franco's fascist regime after WWII? by u/tobbinator
How come nationalist Spain never joined the axis during WWII? by u/Bernardito
Why didn't Spain get involved in World War Two? by u/kieslowskifan