To by Renfe tickets online you can find information on this TA Insider page.