Yes. If you work from Spain, you must register with Spanish Social Security. There are two cases:
- Employee: your company must register with Social Security and affiliate you in the General Regime.
- Self-employed: you must register in the self-employed workers' regime (RETA).
Employees can instead keep their home country's coverage — but only if Spain has a social security agreement with that country, and its administration issues a coverage certificate for teleworkers under that agreement. Only some countries with agreements issue these certificates. Which documents your country issues to prove self-employment, and why the certificate route is for employees only, is set out in proof of self-employment by country.