If you're European, your identity card is sufficient. If you're a non-European citizen, you'll need to travel with your passport. Baggage checks are carried out at all Spanish stations before boarding the train. Make sure you're ready to show your ticket when needed if there's a ticket inspector or member of staff.