Call Rail Europe at (888) 382-RAIL (382-7245) or visit the Rail Europe Web site to book your ticket (see the Resources section below).
Plan on a connection. There are no direct trains from Porto to Madrid. The easiest option is to book a ticket from Porto to Lisbon, and then buy a seat from Lisbon to Madrid.
Anticipate a long journey--about 12 hours, not including connections.
Select your dates, travel times and number of travelers. Look for discounts, such as group or youth rates.
Input all criteria, including service class. If money is not a issue, book a direct train from Lisbon to Madrid and select a sleeper car. Sleeper cars often are available only in first class.
Save money with the less-expensive shared couchette, which will cost you slightly more per ticket. While the couchette isn't as private as a sleeper car, it's still quite comfortable.
Remember that daytime tickets to Madrid often are far more expensive than night tickets, but all tickets usually are moderately priced.
Arrive at the Porto train station at least 30 minutes before departure.
Consult with a teller if you have any questions or want to modify your tickets. Arrive early to do this, because lines at Portugal train stations are often lengthy.
Look at monitors in the main area to find your platform information.
Go to the platform and board the train bound for your destination, most likely Lisbon.
Change trains in Lisbon and travel to Spain. You can store your bags in the Lisbon Oriente station's lockers if your layover is substantial and you want to explore the town.