I've been told both that I do and don't need a visa, so I don't know if I need a Schengen visa for only visiting 3 months. I do know that I need a passport that will be valid for at least 6 months during/after my stay. The rest I do not know. I will be staying with my boyfriend for personal/tourism reasons.
From having a look online you won't need one as long as you're only visiting for under 90 days and for tourist reasons:
https://madrid.usembassy.gov/citizen-services/information-for-travelers/traveling-to-spain.html about 3 years ago