Even setting aside the fundamental wrongness of an adult committing an act of violence on a child, it's just shitty, lazy parenting that's ineffectual at best and detrimental at worst. It conditions children not to do things they're not supposed to purely for fear of punishment, but it does nothing to make them understand why what they did was wrong or what the right thing to do would be. So not only does spanking utterly fail to help the child develop into a better person, but ultimately it won't even be an effective deterrent against bad behavior, because there's nothing to stop them from doing whatever they want as long as they know you won't find out about it.
And worse still, it also teaches them that might makes right and that violence is an acceptable way to resolve conflicts. Spanking has proven to be such a resilient form of discipline because it's quick and easy and gets short-term results, but what's easy in the short term can have disastrous effects in the long term, especially when it comes to something as complex and sensitive as human behavior. You're raising a human being, not a dog. Act accordingly.