In order to legally work remotely from Portugal for long periods of time, you’ll have to become a resident. The Portuguese D7 Visa is an excellent option for remote workers seeking to settle in Portugal for periods longer than 90 days. As a D7 resident, you’ll have the ability to work remotely from within Portugal (whereas in Spain, on the Non-Lucrative Residency, this is not legally allowed).

You are also allowed to obtain local employment in Portugal via the the D7 program.