I'm surprised that the consulate in Valencia could or would not provide a travel letter attesting to the OP's identity and nationality if the OP met all requirements of proof.
These days it's not only the traveler in a bind about an expired passport, the air carrier is subject to penalties if they board that person without proper documentation (in good faith).
I'm very interested in hearing what the return was like. Please keep us posted.