Electroacupuncture has an effective analgesia on chronic pain caused by lumbar disc herniation (LDH) clinically, however, the underlying mechanism is unclear. In this study, we investigated whether electroacupuncture alleviated pain in LDH model rats by inducing spinal microglia M2 polarization. We established a noncompression LDH rat model by implanting autologous caudal nucleus pulposus into L5/L6 nerve root. Electroacupuncture (30 min/day) treatment on the ipsilateral side was started on the 8th postoperative day, once a day for consecutive 7 days. Paw withdrawal threshold (PWT) and paw withdrawal latency (PWL) were tested for pain behavior. Western blotting was used to detect the protein expression in lumbar enlargement (L5/L6). Immunofluorescence was used to detect iNOS+/Iba-1+ and Arg-1+/Iba-1+ and CB2R+/Iba-1+ in lumbar enlargement (L5/L6). We show that PWT and PWL decreased in the LDH group while Iba-1, iNOS, and TNF-α expression increased significantly in lumbar spinal dorsal horn (SDH) after LDH surgery, and revealing that microglia were activated and polarized towards proinflammatory M1 phenotype. Electroacupuncture treatment significantly increased PWT and PWL while reducing Iba-1, iNOS, and TNF-α expression, interestingly, Arg-1 and IL-10 expression were significantly increased. Moreover, electroacupuncture treatment led to CB2 receptors on microglia upregulation, while NF-κB and p-NF-κB expression in lumbar SDH downregulation. Our study indicated that electroacupuncture may reduce nociceptive hyperalgesia by inhibiting microglia activation and microglia M1 polarization and promoting microglia M2 polarization in lumbar SDH of LDH rats, which may be caused by the activation of CB2 receptors on microglia and inhibition of NF-κB pathway in lumbar SDH.