Late Francoist and early democracy statesmen were largely against joining NATO. They wanted a west-alligned but independent Spain (there was even a programme to develop nukes in Spain, that was later scrapped). Then the US came and said that either we joined the alliance or they would force a 'color revolution' to make the Canaries independent.
So, yes, Spain is part of NATO largely against its will.
Even though, in an eventual referendum the 'remain' option would probably win, not because the people actively support NATO, but just for the 'meh, whatever takes the least change/uncertainty '