Book moderately priced travel from Madrid to Zurich at the RENFE Web site (see Resources below).
Reserve a trip from Madrid to Barcelona via the ALVIA route. This will be your first leg on your way to Zurich.
Reserve the second part of your trip, from Barcelona to Zurich, via the TRENHOTEL route.
Be aware that you'll need a customer login and password to register on the RENFE Web site.
Print out the confirmation page and bring it with you on your trip.