Yes, of course. Your salary is a perfectly legitimate business expense. In that case you’ll just pay whatever taxes you owe on your salary locally where you live.
The 20% is the corporate income tax, and you will only pay that once. If you pay corporate income tax to Estonia, you won’t corporate income tax where you live (and vice versa). Estonia also don’t have any withholding tax on dividends.
So whether it makes sense to pay yourself mostly a salary or mostly dividends depend on your personal tax situation. What would you end up paying most for where you live (after accounting for the corporate tax that precedes any dividends)? And since you’re American, you need to take into account that FEIE only applies to earned income, meaning salary, not dividends.
Do you for example qualify for the special tax regime for foreigners in Spain? (That would only apply if you’re working for a Spanish company as well.)
You should also check with a local accountant/lawyer where you live, and ask how the Spanish tax authorities will treat your Estonian company. If they will tax it as a company resident in Spain, it doesn’t serve much of a purpose—at least from a tax perspective. Then you might be better off just incorporating in Spain instead.