As we are 2 UK nationals and have just gone through this process and I wanted to write how it worked for us.

1. We had to register our babies birth here in Spain.
2. We then had to apply for a UK passport which we did on-line and it was straight forwards. The only thing was we need a full 'literal' birth certificate which is not what we received from the hospital (we had to apply on-line for a full copy and it cost €35).
3. We then used our babies UK passport to apply for Spanish residency which was the same process we went through when we came here (plus a few Brexit surprises)
4. We then received our babies residency and NIE number, and have now applied for his TIE card.
5. In one year from the date we gained his residency and NIE number we will be able to apply for his Spanish citizenship and passport.
6. We will have to then renounce his UK nationality. (There is a grey area for keeping his UK passport and this needs investigation both here in Spain and in the UK but I will update you in a year)

Hope this helps for anyone going through this process. All of this has been done with the help of our friendly legal firm and cost us €240 not including the copy of the birth certificate and the €12 you have to pay when you go for the TIE card.