Though Franco's regime had an working relationship with Germany since the Spanish Civil War began, and despite his ideological sympathies, Franco did not want to get involved in WWII. There were Spanish volunteers sent to aid Germany, but Spain remained non-belligerent. Franco had no intention to get fully involved unless it was clear that Germany was going to win, which never happened. Franco's support for the Axis decreased from 1943 to 45. During those years, the US established important diplomatic contacts with the Spanish government. US ambassador Carlton Hayes is credited to have deployed a pragmatist approach to negotiations with Franco's regime, leading to the creation of a Spain-US alliance. In 1953, the Pact of Madrid consolidated the partnership between the USA and Spain.
A couple of sources:
Andrew Buchanan, "Washington's 'silent ally' in World War II? United States policy towards Spain, 1939-1945."
Pablo León-Aguinaga, “The Trouble with Propaganda: The Second World War, Franco’s Spain, and the Origins of US Post-War Public Diplomacy." [Here's a review of León-Aguinaga's article] (https://networks.h-net.org/node/28443/discussions/34697/article-review-471-trouble-propaganda-second-world-war-franco’s)
edit 1:typo
edit 2: To be clear, some Nazi criminals did hide in Spain, just not in large numbers. I found a thread about this same topic that has some related points and links. Spain had nothing to win harboring large numbers of Nazis, while countries like Argentina had their own motivations for receiving them. The issue of why Argentina was a popular destination has come up a couple of times here (see e.g. this thread).
Many Nazis DID flee to Spain. David Messenger has recently published a monograph about the subject.
"Hunting Nazis in Franco's Spain" http://www.amazon.com/Hunting-Nazis-Francos-Spain-Messenger/dp/0807155632