Actually the gradual shift towards US/Spain relations began in the early 40s, during WWII. The U.S. & Great Britain kept communications channels open with Franco's government by allowing oil and grain to be shipped into Spain, despite their stance as a "non-beligerent" but associated with the Axis.
In agreements reached, Franco finally brought Spain into a neutral stance in 1943, and began limiting the shipments of goods to axis powers. One of the main raw products being wolfram (tungsten).
Before and after this time, Franco allowed the underground railroad that was helping Jews & Allied air personnel to operate freely, and in a worse case scenario, made the people who escaped from the Axis controlled areas to stay in Spain, until the end of hostilities.
The Foreign Ministry portion of the Spanish government had already began their swing towards the Allies as early in 1941, even though they were outwardly saying they supported the Axis.
Franco made it official, in the summer of 1943, when he appeared at a function no longer wearing his Falangist uniform, opting for a naval uniform instead, and stated that Spain was neutral. It marked the end of the government claiming they leaned towards the axis. In fact, behind the scenes, they had already began to assist the Allies in many ways, and then removed their volunteer army (I believe it was the 250th regiment of the German Army, which had been 40,000 men strong)from the Russian front.
At that time, FDR began looking at ways to open up relations even further with Franco, and after his death, President Truman continued the efforts. The culmination was the events that took place during the Eisenhower administration, and the opening of naval bases such as Rota.
The Spanish government (according to old State Department records) was concerned that the German army would attempt to land a force in the Iberian peninsula to capture Gibralter, and that fear didn't pass until the Germans themselves were shown as not invincible in Africa. If it happened, Spain's government indicated they would fight against the Germans, and stated they would welcome help from the Allies, because they did not intend to allow Germany to bring the war to them.
Even though there were mixed signals given outwardly, behind the scenes, the ties between the Allies and Spain had already advanced beyond neutrality, and they were more or less siding with us.
If I recall correctly, our Ambassador to Spain at that time was named Hayes, and he ended up being at the center of the negotiations. His close ties with FDR, and the fact that Franco always welcomed him for private discussions indicate that Hayes may very well have been one of the two men who carried out secret negotiations. The other would have been the Ambassador from Great Britain.
As for Eisenhower, he was deeply involved in the negotiations as Commander of Allied Forces, so when he actually became President, the swing was pretty easy to make.
Anyway... That's what I learned from reading over 100 books on Spanish-American relations from 1931 to present.
Wolf (Who has to get a life outside of reading, writing, and scratching fleas