There seems to be a lot of confusion on the time that you need to spend in Spain while you still have your temporary residencia (when you have been legally registered as resident for less than 5 years), now that UK is not longer part of EU and its citizens are 3rd country citizens.
We have compiled some information that might be helpful for you.
With regards to your residencia, if you got it under the Withdrawal Agreement or before was a thing,it is called temporary because you are not considered permanent resident until you have been legally registered in Spain for 5 years, but the residencia you have gives the right to live in Spain permanently.
Residencia is thought for people that live here. In order to be able to renew your residencia in 5 years time, you are supposed to spend in Spain at least 4 of the next 5 years.
This is the general rule for all 3rd country citizens.
They started stamping passports in Jan 2021, so they will be able to start checking how long you spend in Spain and how long you spend out of Spain. When you apply for the permanent residencia in 5 years time you will have to produce current passport and previous one (the one you have now) and they will count the days. If you have not been in Spain for long enough they will not renew the residencia.
If they do not stamp the passport they will also register your entry in the country electronically, so it is the same.
The Withdrawal Agreement did not require physical presence in the host state (Spain in this case) at the end of the transition period – temporary absences that do not affect the right of residence and longer absences that do not affect the right of permanent residence are accepted.
Those protected by the Withdrawal Agreement who have not yet acquired permanent residence rights – if they have not lived in Spain for at least five years – will be fully protected by the Withdrawal Agreement, and will be able to continue residing in the host state (Spain) and acquire permanent residence rights in the host state (Spain) after accumulating five years of residence.
Source:https://ec.europa.eu/info/relations-united-kingdom/eu-uk-withdrawal-agreement/citizens-rights_en
This takes you to our law: Real Decreto 557/2011, de 20 de abril, por el que se aprueba el Reglamento de la Ley Orgánica 4/2000, sobre derechos y libertades de los extranjeros en España y su integración social, tras su reforma por Ley Orgánica 2/2009, about the rights and freedom for foreigners in Spain and their right to live here permanently
The article 148 of this law, which you can find in our Spanish National Gazzette, where our laws are published officially:
https://www.boe.es/buscar/act.php?id=BOE-A-2011-7703
Article 148. Assumptions.
1. Foreigners who have resided legally and continuously in Spanish territory for five years shall have the right to obtain a long-term residence permit.
Likewise, foreigners who prove that they have resided continuously in the European Union during that period, as holders of a Blue-EU Card, will have the right to obtain said authorization, provided that in the two years immediately prior to the application, said residence is has produced in Spanish territory.
2. The continuity referred to in the previous section will not be affected by absences from Spanish territory of up to six continuous months, provided that the sum of these does not exceed the total of ten months within the five years referred to in section 1, except that the corresponding departures had been made irregularly.
In the event of absences for work reasons, the continuation of residence will not be affected by absences from Spanish territory of up to six continuous months, provided that the sum of these does not exceed the total of one year within the required five years
In the case of requesting a long-term residence permit based on the provisions of the second paragraph of the previous section, the continuity of residence as a holder of a Blue-EU Card will not be affected by absences from the European Union of up to twelve continuous months, provided that the sum of these does not exceed the total of eighteen months within the required five years of residence.
This means that in the next 5 years you would only be allowed to be out of Spain a maximum of 18 months (if due to work), but no more than that.
Also, you can not spend out of Spain more than 6 months in any of the given years. This also means you will become fiscal resident in Spain, whether you would like it or not. You would need to speak with a financial advisor or accountant if you have not done so.
Have a good day!