President Franco of Spain had been aided very heavily by Hitler and Mussolini during the Spanish Civil War. However, he did not easily bow down to pressure from them. When Germany was making great gains at the beginning of WWII Germany did not feel that it needed Spain’s assistance. When the war bogged down against the British then Germany decided that it wanted Spain to enter the war with them. Franco did not want to enter the war and made great territorial demands including Gibraltar and many French possessions in Africa. Germany did not feel that it could alienate Vichy France by agreeing to these demands for French territory. Spain had also insisted that they would only declare war once Germany actually invaded Britain. Spain could have made things VERY difficult for the British by firing guns at Gibraltar and closing it down but they never did. Spain did send many troops to their northern border to dissuade Germany or Italy from invading. By this time Germany was planning its attack on Russia and the result was that Spain never entered the war. All this time Spain maintained trade with Britain that was profitable for both sides.
(Book – The Second Work War – Winston S. Churchill)