This is fine if your trips will be no longer than three months at a time, no more than twice a year. 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.