POINTS OF DEPARTURE
Seizure of power, 1936
The intention was never to start a civil war. The conspiring generals (the right wing parties mostly just assumed a coup was coming and were ready to support it) intended to enact a
pronunciamiento, a very Spanish political phenomenon wherein the military steps in to "correct" the political system, mostly without much violence. Happened frequently during the liberal vs absolutist confrontations of the 19th century and was a well known part of politics. The generals anticipated a quick change of power, but didn't figure on mass mobilisation in defence of the republic(or their own necks) by socialist and anarchist militias. The rising was defeated in some places and successful in others and there were sieges that lasted for weeks or months, and this formed the battle lines of the civil war.
Sections of the military remained loyal, others vacillated. The key for Franco was his control of the best troops, the
africanos, which proved to be invaluable for actually making offensives of the sort the republican militias weren't capable of doing. Blocking their transport from North Africa would have swung things decisively in favour of the Republic which, on the peninsula, had all the big cities, the big industrial centres and 2/3rds of the territory. Keeping the Army of Africa out of play would have prevented the early pushes in Extremadura and Andalucía and changed the outcome of many of the sieges where nationalists held out against republican militias. For example, it would have prevented the relief of the garrison in Oviedo (northern coastal strip, strongly republican but fell early to the nationalists) and especially the morale and propaganda victory of the
Alcázar in Toledo.
It was entirely possible that things could have swung decisively one way or the other in those first hours, with either a totally successful seizure of power by the nationalists, or a decisive defeat by the Republic. Particularly if the republican government had have helped arm the militias, or made more efforts to purge the officer corps between February and July, they could've headed off the coup. More likely, there could have been a quicker and more mismatched civil war going in favour of one faction or the other.
International intervention
Basically the key variable is what the big powers do in terms of arming, recognising and blockading the two sides. The non-intervention pact was a farce and it quickly became clear that it was objectively pro-nationalist because the Italians and Germans ignored it. A more robust defence of the republic by France and the UK could have evened things out in military terms, as well as given some of their units more experience in WW2-style warfare, with consequences in the war 5 years later.
Or it could have started a wider war, which is probably something many Republicans would have welcomed. They were always trying to link their battle with the broader clash with international fascism. If anyone saw
Pan's Labyrinth set in 1944 they'll have seen not just the resemblance between Spanish Maquis and the French resistance, but also the touchingly naive hope that liberation of Europe meant liberation for them too.
Alternatively, it's entirely possible that stronger Anglo-French resolve would have given Hitler pause to reconsider his series of gambles that led to expansion and war and delayed or averted a European war altogether.
Battle of Madrid, Republican offensive doctrines
Once it became clear that the Republic was isolated and the Nationalists had strong foreign support, a couple of times during the war, military decisions had a massive influence on the outcome. Franco tried to take Madrid in 1936, got close, but was repulsed. This put him into an ultra-cautious mindset that said "take everything else first and purge the country area-by-area". His German advisors were frustrated with his timidness and caution and it probably hampered the war effort. He really wasn't a brilliant general, all things considered.
Likewise, there was some massive idiocy on the Republican side, a lot of it foreshadowing the propaganda-driven slaughters of the Eastern Front. Basically they (under a socialist premier, Negrín, and strong communist influence) felt that even though they were now clearly outmatched by the nationalist war machine, they had to make offensives and actively fight to gain ground and improve morale. Propaganda moves which they always lost, at great expense. Cases in point are the attacks on Belchite, Teruel, and the Ebro which were spectacular stupid wastes which directly undermined capacity to resist in a time when the republic was clearly outgunned. A more defensive, guerrilla-style war rather than big set-pieces, or even a more defensive guerrilla-style war
in addition to big set-pieces, would have helped the Republicans maintain their capacity to resist for much longer. Possibly until a European war broke out.
Franco enters the war
There was one brief window in which Franco may have entered the war on the Axis side, during the height of German dominance of the continent. Franco, for whatever reason, demanded French North Africa and a lot of resources the Germans couldn't spare (oil and rubber and the like) and as a result the Germans told him where to stick it. Franco and Hitler didn't like each other, and the Spanish nationalists knew if they entered the war they'd lose the Canary Islands quite quickly. The war would have needed to have gone better than it ever did for Germany, for Spain to seriously consider entry.
Plus you know the country was pretty exhausted from the civil war and in no shape to fight another one.