I have had this happen while running before.
I stopped running, so the chase wasn't on. I turned and yelled "NO! BAD DOG" very loudly at the dog. Then I squirted water at it.
Once it backed away I started to walk off, while keeping an eye on it. I started running when it had left the area.
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather, to skid in broadside thoroughly used-up, totally worn out, and loudly proclaiming: WOW WHAT A RIDE!!!!"