Carta de Invitación

The fact is that a visitor MAY be asked by Border Forces anywhere in Europe for any or all of the required documentation when traveling into the EU from a Third Country and if they are not booked into registered Hotel or Vivienda Vacacional accommodation a Carta de Invitación will be required

Facts for UK Nationals Source: Oficina de Extranjería y Fronteras
For all non EU nationals wishing to visit Spain and NOT lodging in paid holiday accommodation, but with friends or family instead, the host in Spain must apply for a Carta de Invitación for each person involved.

This has been in place for all Non EU nationals for many years and due to Brexit is now in place for UK Nationals when travelling to the EU for tourist purposes, when not staying in paid holiday accommodation.
Pages – Entry Requirements (exteriores.gob.es) Quote: entry may be refused (even with a valid passport and/or visa) at police checks in the following cases:

  Journeys undertaken for the purposes of tourism or for private reasons
In these cases, the presentation of any of the following documents may be required:
1.  A supporting document from the establishment providing accommodation or a letter of invitation from a private individual if the foreigner concerned is staying in their home, issued by the Police Station corresponding to their place of residence.
IMPORTANT: Under no circumstances shall the letter of invitation replace the foreigner’s accreditation of all other entry requirements.
2.   Confirmation of the booking of an organised trip, indicating the itinerary.
3.   A return or round-trip ticket.
In order to accredit economic means, the provisions of Order PRE/1282/2007, of 10 May, on economic means, will be taken into account, which foreigners will need to accredit to be able to come into Spain. The amount to be accredited must reach a daily sum of 10% of the gross minimum wage set at 950 euros pursuant to Royal Decree 23/2020, of 4 February, establishing the minimum wage for 2020, which has been extended to 2021.

ONLY Legal Residents in Spain can apply for this Carta de Invitación for the family or friends they wish to receive in their own (or rented) home or a second home they own here, Non Resident Home Owners can not apply for a Carta de Invitación. The latter can only receive Non EU guests in their holiday home if the property is listed as a holiday rental with the Registro de Turismo and they charge for their stay and provide the guests with a tourist rental contract and confirmation of booking.

For those who rent their home, please check that your rental contract doesn’t contain a clause that prohibits guests from lodging with you, or only allows so for very limited time in case they intend to stay for several weeks.

This has nothing to do with any Visa obligation. For Nationals from Non EU countries with or without a required Visa to enter Spain, the Carta de Invitación is an accommodation requirement and if you cannot show a booking for tourist accommodation, then is required instead.
You need to apply for the Carta de Invitación with the National Police in your area, with a cita previa https://sede.administracionespublicas.gob.es/icpco/index
fill out the form below for each guest http://www.interior.gob.es/documents/642012/8080219/Solicitud+de+Carta+Invitacion.pdf/
Complete Modelo 790/12 to pay the administrative fee. Tick ‘Solicitud Carta de Invitación’. The amount of €74.31 will appear. https://sede.policia.gob.es/Tasa790_012/ImpresoRellenarThe following documents are required when you go to your appointment.
✼ Title deeds or rental contract for the property where the guests will be lodging
✻ Padrón Certificate not older than 3 months
✼ TIE or Green EU Residency Certificate and Passport plus copies
✼ Copies of the passports of the guests that will travel from the UK to Spain to stay with you
There is no fixed window to process your application, it depends on how busy they are, but generally no more than 20 days.

Once you have been notified that your application has been resolved favourably, you can pick up the the Carta(s) de Invitación. You’ll need a second modelo 790/12 form, tick ‘Expedición de Carta de Invitación’. No amount will appear, you need to print the form and put in the amount of €6.43 times number of guests. Note that these amounts vary each time the State General Budget for the following year is approved and published.
Once you have the Carta(s), you need to physically send them to the UK so that the guest can bring the originals with them when they travel to Spain.