My experience is that a squirt of water will surprise and slow down the dog enough for me to get away. I don't know that it "teaches" the dog anything, other than maybe it's only water.
Another observation is merely the act of pulling out and pointing the water bottle causes some dogs to pause.
I would not, under any circumstances, spray a dog that was on his own property.