Spanking a dog does not work.  When you touch a dog they will become more intense, be it excited or aggressive.  I wait for the dog to lay down and look at me then give it a reward, even praise is enough.  Ignoring bad behaviour works well too for all but the most aggressive outburst and even that can usually be addressed with the equivalent amount of intensity in your voice and overall expression.
 
I've rolled problem dogs to the ground to stop a vicious fight with another dog, if I raise a dog from a puppy this is not required.  If the other dog is the instigator I just stand between them and stare until it backs off.