From the Spanish Embassy in London's website,
"Entry into Spain for stays not exceeding 90 days within a 180-day period is subject to the conditions provided for in Regulation (EU) Nº 2016/399, of the European Parliament and of the Council, of 9 March 2016 on a Union Code on the rules governing the movement of persons across borders (Schengen Borders Code)
Being in possession of a valid passport or travel document
The document must be valid for al least three months following the projected exit from the territory of the Members States, and must have been issued within the last ten years. Citizens from any State of the European Union, Switzerland, Norway, Iceland and Liechtenstein only need a valid national identity document or passport. Citizens from the United Kingdom and Ireland will require a passport since their countries are not members of the Schengen Area."
I think it's clear a valid passport is needed.