Two of my friends bought yachts in Spain. Regulations and mooring costs differ from region to region. There is paperwork involved. You will need an NIE number from the Spanish embassy in Dublin.
Warning:- Both friends (expat Brits) bought from expat Brits. Both hulls were infected by osmosis and both yachts are unseaworthy and useless.