I think it should be legal, but I also agree that the better discipline is to put them in Timeout and explain the reasoning for the punishment -- what rule they broke and why there is such a rule in the first place. However the latter form of punishment depends upon the mental capacity of the child... If a 1-yr old were to run out into the street, then spanking is the better option since there is an immediate cause and effect relationship that the child understands. If the child is now 3 and runs into the street, then timeout is better because not only will the child learn from the immediate punishment, but then after timeout the parent can explain why they were put in timeout -- the dangers of traffic on the street, drivers not able to see the child in time to stop, etc. -- and the explanation will show the child the true values of the household as well as let the child know that the punishment is done out of love, not hate.
Our family actually ran into a problem with one of our caretakers... my sister was always big for her age, so people often mistook her for being older than she actually was. My mom had gone to the caretaker to pick my sister and I up, and witnessed the caretaker telling my 1-yr-old sister "Now K-- we discussed this earlier. You are not allowed to go into the kitchen by yourself...." My sister had a confused expression on her face and my mom realized that she wasn't getting anything out of it, nor did she probably understand the earlier "discussion". My mom took the caretaker aside and reminder her of my sister's age, and gave the caretaker permission to give my sister a light spanking on her butt if she broke a rule of safety so that my sister would understand what a "discussion" wouldn't make clear.