Would bear spray work on a goat?
I can't see why not. There are enough anecdotal stories of bear spray successfully being used on many different animals.
One thing about bear spray...and regardless of who or what you are spraying, you need to be of the sound and very quick mind to instantly deploy it and not freeze when the animal comes charging at you. Also the wind has to be in your favor which in the mountains, can be very unpredictable and can be either blowing toward you and or swirling around you. Once you come to the conclusion that you need to use the spray, you have mere seconds to react before it could be too late. Spray too soon, then you you could end up having a very bad day and the final outcome may not be in your favor...
I carry bear spray and would not hesitate to use it on any animal if I felt my life or another person's life was in danger.
That said, avoid putting yourself in that tight situation and you will have no problems, yet still be able to see and enjoy wildlife in their natural settings. On Saturday we were watching a female black bear with a cub born this year off in the distance. Mama bear knew we were close by but not a threat and other then the occasional sniff in the air, continued to feed away in the meadow totally ignoring us. Had we been ignorant in bear behavior and moved closer, then it could of been a totally different situation and outcome.