Spain did the right thing. The U.S. has been wrong every step of the way in “Kosovo.”
The reason why Spain doesn’t recognise the declaration of independance by Kosovo was due to its own internal provinces that want home rule/independance - Catalonia, Galicia and Basque Country.