Hi Miss Sunshine,
Labour tax:
If you are a tax resident in Portugal, ie,
- staying for more than 183 days, consecutive or interpolated, in Portuguese territory;
- if less than 183 days of permanence, have at your disposal a house in Portugal in such conditions that make presume a present intention to maintain and occupy it as habitual residence;
then the worldwide income from your work will be taxed in Portugal.
If you stay less than 183 days in Portugal, then there is the issue of habitual residence.
If the worker fulfils the concept of residence in more than one country, the double taxation conventions between Portugal and several dozen countries, including the USA, contain a criteria to determine which country will be considered the State of residence.
The first tie-breaker criteria in the OECD Convention is based, in the first place, on the existence of residence. If the worker has his or her own house in Portugal and leaves the place of residence that he or she had in the USA, he or she will be considered resident in Portugal.
If he maintains two residences, one in Portugal and the other in the USA, he will be considered resident in the country with which his personal and economic relations are closer (centre of vital interests, including teleworking). If this is the case, Portugal will stop taxing you as a resident and the other country, USA, will gain the right to tax you for your worldwide income (including income obtained from your work in Portugal).
Please note: the 20% rate only applies if you have a high value-added profession, and if the income from your work is taxed in Portugal.
Social Security:
In the case of countries outside the European Economic Area, it is necessary to check whether Portugal has concluded any Convention or Agreement with these countries at the level of international coordination and mobility. At the moment, Portugal has a Convention or Agreement with Andorra, Argentina, Australia, Brazil, Cape Verde, Canada, Chile, United States of America, Morocco, Mozambique, Moldova, United Kingdom, Tunisia, Ukraine, Uruguay and Venezuela.
Convention with USA:
https://www.seg-social.pt/estados-unidos-da-america
(translation required) See applicable law section ( "Legislação aplicável")
As you can see here on the Portuguese Social Security website, as a general rule:
Employees who carry out a professional activity as an employee in one of the countries (Portugal or USA) are subject to the legislation of the country where they work, even if they reside or the company or entity that employs them is based or domiciled in the other country. If this is your case, and you are working remotely in Portugal for a US company, then US law is applicable to you.
Freelance work/Self-employed workers are subject to the laws of the country in which they live, even if they also work in the other country. If this is your case, as you live in Portugal, the Portuguese social security legislation is applicable to you.