If you want to pursue a degree program in Spain that has a duration of more than 6 months then you would definitely need to apply for a residence permit within 30 days of your arrival.