I feel it's best not to leave dogs outdoors unsupervised, even in a fenced yard. So many things can happen, some very bad. What I do when my dogs bark at a dog next door--or at anything else when they are outside--is to call the dog to me. I give petting, praise, and a few tosses of a ball or treats. Then I release the dog.
If the dog goes back and barks again, I call again and run through the same routine. I had one dog who was very extreme in this behavior--it was downright scary. At first I had to do the routine, I kid you not, SEVEN times! But it worked! Before long, she would bark once or twice and then look at me, knowing I would call her.
Do not get mad or punish the dog in any way if you have to bring the dog to you again--and again! The reason this method is so extremely effective is that the barking raises the dog's adrenaline level, and that is actually addictive. Calling the dog, when the dog comes to you the adrenaline drops. It is dramatically beneficial to the dog in more than one way.
If your dog doesn't come when called when excited, you have serious, vital training to do. Use a long line--it may be necessary to use it for 6 weeks, every time you call the dog. The dog has to form the habit of coming when called.
Also, spay/neuter does help behavior in many cases. It can help health, too, and even save dog's lives. So that's something to seriously consider.
-----
Kathy Diamond Davis, author, "Therapy Dogs: Training Your Dog to Reach Others," 2nd edition, and the free Canine Behavior Series articles at http://www.veterinarypartner.com/Content.plx?P=SRC&S=1&SourceID=47