You can book your tickets online at
Alsa/Enatcar website which is available in English. As Eddie said, online reservations have to be made at least 24 hours in advance. Otherwise, you'll have to go to the bus station (Estación Sur de Autobuses at Méndez Álvaro) to buy the tickets.