Being a fiscal resident in a country does not automatically mean being a non-resident before the tax authority in another country.
When the income of a resident comes mostly from another country, it is possible that this person be also a fiscal resident in the other country. This is regulated in the respective laws on Income Tax of each country and not, as it would be expected, in the double taxation agreements. It all depends on the percentage and the type of income in each country.
So it is necessary to study each concrete case.
In Germany is the 90%. That is, when the income of a resident in Spain comes from Germany, as per the 90% or more, this person can request to be treated in Germany as a fiscal resident, even if he does not live there. Therefore, he is a resident for tax purposes in two countries: Spain and Germany. The cases are usually retirement pensions, income from rentals, etc.
What is the purpose of this?
Generally, for a non-resident, the minimums exempt from taxation are not applied. Taxes must be paid from the first euro. The advantage is, precisely, to enjoy these minimums exempt from taxation to lower the tax pressure.
The process is through a certificate issued by the tax authority of the country of effective residence through the form Eu/EWR.