I don't think of spanking as a way to inflict pain on your child. Generally a light tap/spank will do. It's a way to re-focus them.
You're basically reiterating the fact that mommy and daddy are the parents, and they have the right to do things that children can't. We also use sharp objects, when we tell our kids to not play w/ them, and we drink alcohol when we teach kids to not drink it. It's not hypocritical, it shows the control, and certain amount of power (for lack of a better word) that parents have, which is important in teaching kids to respect you.