FWIW, during the GW Bush years, my brother, a US citizen, flew from the UK to the US while wearing a t-shirt that said "Havana" and US immigration grilled him and went through his luggage looking for proof he had been in Cuba. But he hadn't. If i remember correctly, at that time the fine for visiting Cuba could be up to $8k.
I, a US citizen, went to Cuba during the Obama years, brought all this proof that I had (admittedly distant) family there, and immigration asked me one question "Where are you coming from?" I said "Cuba" and he waved me through.
My US citizen parents have been to Cuba multiple times during the Obama years and once before Trump announced that he wanted to go back to the failed Cold War era embargo of Cuba. They didn't bring any proof of family in Cuba, and weren't given any grief by US immigration.
But if you are flying from Spain to Cuba to Spain, none of this will matter.