Its best to ask direct to the dept for individual rights.
You may not be entitled unless you become a UK resident again, which takes 3 months.
When I arrived back and was seeking a job I did apply for JSA, I took one look at the form to fill in or rather huge book and didn’t bother, luckily I was working within a month and that allowed me to claim working tax credits and family tax credits.
From the phone call advice I was given in 2007 I would not have been entitled to JSA as I was out of the UK for 4 yrs, aparantly you have to have s certain time in the UK before, but don’t give up on my advice.
You may be able to claim JSA when you return to Spain though, worth checking out, probably in the CAB.