A neighbour of mine arranged this for his children a few years ago now. Neither he or his wife were working or paying into the Spanish system - they didn't want to start paying private care because they were both looking for work at the time, which would take care of their contributions (This was 5 years ago, so they were fortunate in finding work quite easily!). They were told that being on the Padron and/or having a valid EHIC card would entitle the family to free emergency healthcare, but in order to obtain free healthcare in full from the Spanish state, they would need to apply for a letter from the DSS in Newcastle (In Spanish) requesting that their UK entitlement be 'exported' to Spain.
(Many apologies if I am behind the times and that has now changed)
The address to write to in order to request the letter is here :
'Legislative letter – SPAIN.
Overseas Benefits Department
Newcastle Upon Tyne,
NE 98 1BA