An automatic spray mechanism provides a deterrent to keep animals away from flower beds and other restricted areas in a yard. The mechanism comprises a bottle which is filled with a liquid and inserted into a holder having a plurality of anchors which enables it to be secured into the ground. The top of the bottle comprises a powered spraying assembly comprising a pump, a suction tube, and a directionally adjustable spray nozzle. The mechanism is activated by an electronic motion sensor so when an animal such as a cat, dog, or wild animal approaches, it sprays the liquid.