Spanking is not the end all of discipline, but it is a useful and fruitful part of it when done properly and used sparingly.
Anger should never be the motivation. Some parents don't even realize they are in fact abusing this discipline method. What they call "righteous indignation" is really only uncontrolled, self-gratifying anger, which only ends up crushing their child's spirit and driving him away. No matter how much the parent tries to assure the child he or she has their best interest at heart, their abusive spanking will always be interpreted as hatred and rejection.
Since parents are a child's first representatives of God, this abusive spanking eventually leads to a skewed view of God and can hinder the child's relationship with Him. We have an awesome responsibility as parents to learn the right use of this serious part of discipline and to use it wisely when it is indeed necessary.
And that leads to another point. Spanking should be reserved for only the worst offenses, just as the death penalty and church discipline are only used for the worst offenses in other areas of society.
Two books which have been a blessing in dealing with this issue are The Heart of Anger: Practical Help for the Prevention and Cure of Anger in Childrenby Lou Priolo and Shepherding a Child's Heartby Tedd Tripp.
Please feel free in the Comments to suggest other balanced, faith-based books and resources you have found to be helpful in child rearing.