Spain's railway network has over 15.000 kilometres. RENFE is the public company that controls most railway transport in Spain (some places like Cataluña, have also their own railway system that works in combintation with RENFE). At RENFE's website you can search for schedules, prices and kinds of trains and they will inform you on where to obtain your ticket
Telephone bookings (including home delivery) can be done by calling to the telephone number 902 15 75 07. Telephone bookings are possible between 5.00 AM and 23.50 PM. Ticket home delivery is only available in Madrid, Barcelona, Sevilla and Valencia.
At all main train stations it is possible to acquire tickets or book your seats for trains in other European countries. Some of the most common international bookings are for the Eurostar (Paris-London) or for the Thalys (Paris-Brussels-Amsterdam-Cologne).
From Madrid and Barcelona there are some trains with direct connection to some EU cities :
Talgo Catalán (Barcelona-Montpellier)
Mare Nostrum (Cartagena-Barcelona-Montpellier)
Francisco de Goya (Madrid-Paris)
Joan Miró (Barcelona-Paris)
Salvador Dalí (Barcelona-Milan)
Pau Casals (Barcelona-Zurich).
You can also reach more European destinations by exchanging trains at the border with France.
Many EU countries offer special prices for people under 26 years old in different products. RENFE offers a handfull of different products related to youth-travel in Spain and the EU. The most famous of which is the Inter Rail. This ticket allows young people to travel in second class for one month within the countries that support this project.