The Directorate-General of Taxes, in a consultation conducted last June by a tax resident marriage in Lebanon, states that the tax residence of natural persons is determined by the provisions of Article 9 of the IRPF Act, which states, among other circumstances, that the taxpayer shall be deemed to have his habitual residence in Spain when he “stays more than 183 days, during the calendar year, in Spanish territory.
You can find the reading of the article in the following link https://bit.ly/34IGtve