FYI Malta is no longer on the blacklist.
Yes, if you want that your foreign company avoid to be taxed in portugal, you have to show that you are not doing any work from there. You need office, manager, staffs, in your offshore company. Be carrefulif you rent an office in portugal it could be...