If by “hitting”, you mean slap, punch, wallop or anything like that, then you come up with the “yes” answer. You might also pull hair, gouge, pinch and more. Things like these are portrayed as barbaric and abusive, and they should be. Is there a better way?
Let’s look at the context: usually the parent does such things as a reaction to the child’s actions. It’s merely an emotional response. It is meant to be a punishment to stop the behavior; but it is more for the parent’s sake than the child’s sake.
Here is another context: The parent is calm, and the parent is interested in the benefit of the child. He/she knows better than the child that negative behaviors will produce trouble in the future. So he explains, for the child’s sake, why a spanking is necessary. The spanking adds significance to the parent’s words. He/she uses the experience to teach right from wrong. In this case, spanking your child teaches them not to hit others.
The key is your own self-control and motive. Nobody knows that but you.