I would say that it is dependent on both the child and the parents.
It is effective on some children (myself, for instance), but not on some. Some children will respond to other methods better (some to "time outs", some to removing things [toys, games, television, etc.], some to yet other means). And some, seemingly don't care what the punishment is, and will do what they want regardless.
And it also depends on the parent doing it. If the parent stands fast by the punishment, but insures the child realizes what was done wrong and why, then it is more likely to be effective. If the parent is inconsistent with punishment, if the parent coddles the child afterwards, etc, then it tends to lose effectiveness.
Also, spanking should be a last resort punishment. If the child tries to do something and is told not to, then tries to do so and is otherwise punished, then tries to do so again. At this point, spanking would be a correct punishment.
As well, the more the punishment is used the less effective it tends to be. I have known people who were spanked so much, they no longer even cared. At which point the punishment was moot.
This often leads to incorrect use, or even downright abuse of the child. One individual I grew up with was spanked so much he no longer cared, at which point the punishment became more severe. until, in his teens, his mother would actually slap him as hard as she could.
As for moral or ethical, I see no call to think it is not.
Proverbs 13:24 (NIV)
He who spares the rod hates his son, but he who loves him is careful to discipline him.