Spanish attitudes towards different races will obviously differ from one person to the next. Spaniards are generally accepting of travelers and helpful. However, since Spain has only recently experienced increased foreign immigration, students of non-Caucasian backgrounds may encounter ignorance about their cultures which can be interpreted as prejudice. Note that the Spanish custom of staring should not be taken as offensive, since it is a common habit. Feel free to stare back!
Ultimately your experience in Spain depends on your attitude. Be tolerant towards others and be patient if they are intolerant towards you. After all, you came to Spain to learn about a different culture, and it will be different.