At an administrative level, there is no single regulation for the entire State, so we will have to attend to what is regulated by each of the Autonomous Communities or Cities. Thus, there are actions that may or may not be sanctioned depending on where we are.
In addition, the City Councils have Municipal Ordinances that regulate the possession of animals, so that they can also establish minimum standards of animal welfare for those who are in a certain municipality or city.
At the criminal level, the regulation is state, a single Penal Code applicable to the entire State. It regulates cases of mistreatment and abandonment of non-wild animals.
Depending on the case before which we find ourselves and the urgency of the action, we will have to resort to criminal or administrative channels.