Some dog owners use pepper spray to back off other dogs. While this can work, it can also backfire. With pepper spray, you MUST check what the wind is doing before you use it. The wind must be from behind you, otherwise it will come back into your face and your dog's face. Also, I've not seen, but have heard that it can just make some aggressive dogs angrier.
No matter what you decide to use, being prepared is important. If you can have a couple of options available, that's even better.
Be Careful- Safety for You and Your Dog
If the off-leash dog approaching you truly shows aggressive intent, try to get your dog out of trouble. Pick him up and place him on top of a nearby car. Toss him over a fence. Hold a small dog on your shoulders.
If you have a larger dog and can't lift him, consider if it might be safer to drop your dog's leash. Would he run home? Perhaps that would be the best choice. But don't do that if he could potentially get hit by a car.
If a fight occurs, don't scream. That tends to get an aggressive dog more worked up. Instead, maneuver yourself to get behind the instigator and then quickly lift his back legs as high as you can. Don't drop his legs until all the fight is out of him. Then hook him up to a leash and muzzle him with the leash; wrapping it around his muzzle several times. Then call the police.
Walking your dog should be enjoyable for you and your dog. An off-leash dog can certainly ruin that for both of you and be potentially dangerous. Thinking about what to do and being prepared can alleviate some of the uncertainty.