Imo, when this subject comes up, it is normally accompanied by the question "how far is too far". Until recent history, this has never been legislated, but as far as I'm concerned, any "discipline" that requires this question (and without asking it, can lead to abuse), then the "discipline" method needs to be changed.
I recently started a new job (February). I now teach a parenting course, and talk with the participants in individual sessions. I'm currently nearing the end of the first course, which is about attachment-based parenting. If you are a parent who creates a safe and secure attachment with your children (this is accomplished through attunement and meeting their needs, which creates a safe, trusting relationship), then you likely will never need to "spank" your children. If your children experience a safe parent most of the time, they are likely to become avoidant, ambivalent, or worse, disorganized in their attachment styles. This means that the "safe" person is also the "unsafe" person, and they learn that "love" is sleeping with hitting, yelling, etc. Children's attachment styles will affect their adult relationships.
When you use attachment-based parenting, you create a safe relationship where you seize opportunities (such as misbehaviour) as a time for teaching your children and setting firm, clear, concise boundaries with an explanation of the consequences. When children learn this kind of trusting attachment, they are likely to listen. Misbehaviour becomes little more than the attempt to push boundaries and maybe assert more developmental independence.
Spanking is not illegal in my country, as long as there is no physical damage or markings. That's fine, but the damage it can do to their trust in you as the safe parent will absolutely be affected. Use the proverbial "rod" to guide, to teach, to build character so that they grow up to become self-disciplined and intrinsically rewarded rather than fear-motivated. When you discipline your children, do nothing that will give them any reason to question your relationship with them.