Eryngium pyramidale Boiss. & Hausskn. is one of the species of the Apiaceae family, which is used as a spice in Iranian food. In this work, we aim to assess the phytochemical profile and antibacterial activity of the aerial parts of Eryngium pyramidale. The essential oil was obtained by hydrodistillation using a Clevenger apparatus. Then, it was quantitatively and qualitatively analyzed by GC-FID and GC-MS, respectively. The antibacterial activity of the essential oil was evaluated against six gram-positive and three gram-negative bacteria by the disc diffusion method and the broth microdilution assay. The phenolic and flavonoid contents of the methanolic extract were assessed using the UV spectrophotometry and HPLC-DAD. A total of 56 compounds representing 94.08% of the total oil were identified, among which sesquicineole (28.49 ± 1.2%) and (Z)-falcarinol (18.04 ± 0.7%) were the major ones. Based on the results, the oil was active against both gram-positive and gram-negative bacteria in comparison with standards. The phytochemical screening of the extracts revealed the presence of flavonoids, steroids, glycosides, and phenols in the methanolic, ethyl acetate, and n-hexane extracts. The total phenolic content of the methanolic extract was 0.36 ± 0.01 mg of gallic acid equivalents per g of dry plant materials, and the total flavonoid content of the methanolic extract was 0.90 ± 0.05 mg of quercetin equivalent (QE) per gram of dry plant materials. Five phenolic and flavonoid compounds in the methanolic extract including naringenin, rutin, apigenin, caffeic acid, and gallic acid were identified and quantified.