Hello

You can certainly work as a freelance for your US employer but as a resident in Spain you will be in the obligation to declare your income in Spain every year. You need to notify the US authorities that you are now a Spanish resident.

Please read these articles concerning double taxation treaty between Spain and the US. The aim of this treaty is to avoid being taxed twice.


Article 15

Independent personal services

1. Without prejudice to the provisions of Article 7 (business benefits), income that a resident of a Contracting State obtains from the provision of professional services or similar activities of an independent character, may only be taxed in that State. However, such income may be taxed in the other Contracting State if that resident has or has regularly disposed of a fixed base in the other Contracting State for the performance of said activities. In such case, only the income attributable to said fixed base may be subject to taxation in that other Contracting State.

2. The term "professional services" includes especially independent activities of a scientific, literary, artistic, educational or pedagogical nature, as well as the independent activities of Physicians, Lawyers, Engineers, Architects, Dentists and Accountants.
You won´t have a right to social security as you won't be a registered worker in Spain. You need to omfomr the US Tax autjhjortes that you ara a fiscal resident in Spain. The purpose of the treaty is not to be taxed twice.

Article 20

Pensions, annuities, alimony and child support

1. Without prejudice to the provisions of Article 21 (Public Functions):

a) Pensions and other similar remuneration obtained by a resident of a Contracting State who is his or her actual beneficiary, by virtue of prior employment, may only be taxed in that State, and

b) Social Security benefits paid by a Contracting State to a resident of the other Contracting State or to a citizen of the United States may be taxed in the aforementioned State.

2. Annuities obtained by a resident of a Contracting State who is his or her beneficial owner may only be taxed in that State. The term "annuities" in the sense of this section means a pre-fixed sum paid periodically at specified dates during a given period of time, in accordance with an obligation contracted in return for adequate and full compensation (other than the provision of services).

3. Maintenance payments paid to a resident of a Contracting State may only be taxed in that State. The term "alimony", as used in this section, means periodic payments made in accordance with a written separation agreement or divorce decree, separate maintenance, or compulsory aid, in respect of which the recipient is subject to taxation in accordance with the laws of the State of which he is a resident.

4. Periodic payments for the support of minor children in application of a written separation agreement or a divorce decree, separate maintenance, or compulsory assistance, made by a resident of a Contracting State to a resident of the other Contracting State they can only be taxed in the aforementioned State.

Regards,