Spain follows the common rules of the European Union. From any country your pet needs microchip, rabies vaccination and import declaration. Everything else depends on where you fly from: the EU sorts departure countries into groups, and the group decides whether you need an EU pet passport or a health certificate, and whether a rabies titre test is required.
The titre test is what makes the timing. Blood is drawn no earlier than 30 days after the vaccination, and entry is allowed no earlier than 90 days after the draw. So from Turkey and China, starting from zero today, the earliest departure is January 23, 2027; from United Kingdom, France, United Arab Emirates and United States no titre test is needed.