Background: Growing evidence suggests that gut microbiota can affect depression-like behavior, and electroacupuncture (EA) can regulate the composition and abundance of gut microbiota. At the same time, not a lot of research has been done on how EA affects gut microbiota to depression-like behavior. The objective of this study was to study the associated mechanisms by which EA exerts antidepressant effects by modulating gut microbiota. Methods: Twenty-four C57BL/6 male mice were randomly divided into three groups, one group (n = 8) was the normal control group (NC). And the other two groups was chronic unpredictable mild stress for modeling + electroacupuncture group (CUMS + EA) (n = 8) and chronic unpredictable mild stress for modeling group (CUMS) (n = 8). Both CUMS and EA groups were subjected to 28 days of CUMS, but only the EA group received an additional 14 days of EA procedure. Behavior tests were used to determine the antidepressant effect of EA. Sequencing of the 16S ribosomal RNA (rRNA) gene was applied to examine alterations in the intestinal microbiome between groups. Results: The findings were compared to those of the NC group, the sucrose preference rate and the total distance of Open Field Test (OFT) in CUMS group decreased, the abundance of Lactobacillus decreased, while the abundance of staphylococci increased. After the intervention of EA, the sucrose preference index and the total distance of OFT increased, the abundance of Lactobacillus increased, while the abundance of staphylococci decreased. Conclusions: These findings indicated EA may play an antidepressant effect by adjusting the abundance of Lactobacillus and staphylococci.