Pretty much exactly as I said
As for the company needing to be registered in Spain, they didn't seem to agree that was necessary and were happy for me to be Spanish resident and just invoice a UK business (No vat for an individual invoicing a business which was another worry i had that i'd lose 21% straight away!). He suggested there was nothing like IR35 over there and being an Autonomo it's ok to work for 1 or multiple companies. This is a relief as it was a big stumbling block for me.
The company doesn't need to be registered in Spain because you would be an Autonomo.
If you were still employed by your current company but working in Spain, then that is when they would need to open an office, but not with you working as a self employed individual.
If you registered for VAT you wouldn't lose 21%. Where an EU business provides services to a business in the UK, VAT will not be chargeable in that providers state.
So basically you would invoice a usual and without VAT (but include the UK companies VAT number on your invoice just for a belt and braces approach). The UK company would then effectively invoice itself for VAT and then apply a reverse charge on its vat return.
social security fees are €300 plus a month, but there is a reduced plan of €60 per month for the first 12 months of self-employment. The payments then rise to €144.50 per month for months 13-18, and €202.30 per month from months 19-24.
For self-employed men under the age of 30 years and women under 35 years, there is a further reduction for an extra 12 months of 30%, bringing their total reduction period to 36 months.