Buying train ticket at Atocha Station vs. pre-booking

I am flying into Madrid standby and am not sure which flight I will be taking in. I was hoping to buy my ticket from Madrid to Malaga at the Atocha Station. Is this possible or do I have to pre-book the ticket? Thanks
2 people have
this question