If you want to spend more than six months a year in Spain, you can't do so on a Schengen Visa, and will have to secure a long-stay visa before visiting the country. You can spend up to 183 days a year in Spain, consecutive or not, without becoming a long-term resident.