The Nazi government helped the nationalists win the Spanish Civil War. It seems like after this it would make sense for Spain to join the Axis during the Second World War so why didn't they?
More can always be said, but my older answer here, as well as this section of the FAQ, explores various aspects of this question.