In general, you must meet two conditions before you travel:
It is possible for EU citizens to pass through France, and there are no restrictions in Spain for passing through or onward.
Further information can be found on the website of the Foreign Office.