I had understood that an EU national could spend a maximum of three months continuously in Spain without registering.
And that he could return again and spend up to a further three months without registering.
However, the maximum in a year was 183 days. Non-EU nationals could spend three months in any six months.
J C (Costa del Sol)
Some years ago this was the regular routine. That is, a tourist stay of 90 days with no formalities, plus an extension of a further 90 days, which was easy to obtain. People had passports with 10 or 12 prorrogas stamped in them.
Or they would go to Morocco for the weekend and then return to begin another tourist stay of 90 days. The law was the same; it was enforcement that was lax. This led to misunderstandings.
If you wish to delve deeper, you can consult Article 30 of Ley Organica 4/2000 del 11 de Enero, along with its various modifications over the years, and the reglamento of this law, which specifies how it should be carried out.