The invention relates to an electromagnetic-detection-based intelligent greenhouse pesticide spraying robot and method. The intelligent greenhouse pesticide spraying robot is composed of a central controller, an electromagnetic detection identification path module, a permanent magnet detection module, an image processing module, a pesticide spraying module, a pesticide dispensing module, a drug detection module, a wireless communication module, a human-computer interaction module, a self-state detection module, a driving module, an alarm module, a storage module block, and a power supply module. The central controller is connected with the electromagnetic detection identification path module, the permanent magnet detection module, the image processing module, the pesticide spraying module, the pesticide dispensing module, the drug detection module, the wireless communication module, the human-computer interaction module, the self-state detection module, the driving module, the alarm module, the storage module block, and the power supply module. According to the invention, the whole pesticide spraying process of fruit and vegetable plants in a greenhouse can be completed intelligently; the pesticide wasting and residue can be reduced; the work efficiency and pesticide utilization rate can be improved; and thus people can be protected from being injured by the pesticide.