Not sure about Portugal but suspect it's not much different than other European countries. When I did a freelance job for Nokia in Berlin I effectively worked for a Swiss company, which sent me off to Berlin. I registered myself in Switzerland, got a social security number there, and paid my income tax in Germany. As far as I understand it, Nokia paid the Swiss company, who paid their tax in Switzerland. Much as you'd expect - you (be it an organization or an individual) pay tax in the country in which you're situated.