Madrid is the geographical center of Spain, and all major train lines depart from one of its two main train stations (Chamartín and Atocha) or pass through Madrid. Though train travel is comfortable, for some destinations buses run more frequently and make fewer stops; this is true for Segovia and Toledo, unless you take the more expensive high-speed train.
Commuter trains to El Escorial, Aranjuez, and Alcalá de Henares run frequently. The best way to get a ticket for such trains is to use one of the automated reservation terminals at the station. You can reach Segovia and Toledo from Atocha station in a half hour on the high-speed Alvia and Avant lines; if you book ahead, the ticket may cost less than €25. Train stations in Toledo and Segovia are outside the city, meaning once there you'll have to take a bus or a taxi into the center.
The high-speed AVE can get you to Barcelona in less than three hours. If you buy the ticket ahead online (with discounts up to 60% off the official fare), you may pay less than €40 each way for (often nonrefundable) tickets. Otherwise expect to pay between €60 and €100 each way—the higher price is for nonstop service.
Estación de Atocha. Glorieta del Emperador Carlos V, Atocha, Madrid, Madrid, 28045. 91/232--0320; www.adif.es.
Estación de Chamartín. Calle Agustín de Foxá s/n, Chamartín, Madrid, Madrid, 28036. 91/232--0320; www.adif.es.
Estación de Príncipe Pío (Norte). Paseo de la Florida s/n, Moncloa, Madrid, Madrid, 28008. 90/210--9804.