Not for travellers from the UK. Since 7 June 2021 at least, it must be a PCR test, an antigen test is not enough.
Spanish government sources, current (14 August 2021):
https://www.mscbs.gob.es/en/profesionales/saludPublica/ccayes/alertasActual/nCov/spth.htm
Tab
Entry Requirements from Third Countries,
Point k):
Persons with a vaccination certificate, that the [Spanish] Ministry of Health recognizes for this purpose, after verification by the health authorities, as well as their accompanying minors (under 12 years of age). For persons resident in the United Kingdom of Great Britain and Northern Ireland coming directly from this country, in addition to the vaccination certificate, diagnostic certificates of NAAT tests (nucleic acid amplification tests, e.g.: RT-PCR, RT-LAMP, TMA, HAD, NEAR, CRISPR, SDA.....) will also be considered valid.
Orden INT/657/2020, de 17 de julio in combination with
Resolución de 4 de junio de 2021
Point k) in combination with Point Séptimo 1:
Pruebas de amplificación de ácido nucleico molecular (NAAT), cuya muestra haya sido obtenida dentro de las 72 horas anteriores a la llegada a España.
Point Séptimo 2 lists antigen tests but they are explicitly excluded for travellers from the UK.