On the other hand:
IF you do not want to appear on the list of the "chamber of trades and commerce" of your country of residence or
IF you cannot have a company in your country of residence …
You can still practice your professional activity in your country by creating a branch of your Spanish company (you will not appear on the list of the "chamber of trade and commerce" in your country) … BUT, legally, It will be necessary to your Spanish Company to have an activity in Spain also (even if it is minor).
Any doubt? Call me; information is free of charge!