A superhydrophobic coating composed of epoxy on the bottom and siloxane-modified silica on the top was prepared by employing the scraping and spraying methods. The superhydrophobic coating possesses excellent mechanical properties, is superhydrophobic (water contact angle, WCA = 164.3°), and has low adhesion. The long-term corrosion resistance of the epoxy coating and the superhydrophobic coating in a 3.5 % NaCl solution and hydrogen sulfide environment was assessed using electrochemical impedance spectroscopy (EIS), polarization curve analysis, immersion testing, and X-ray diffraction (XRD). Test results indicate that the superhydrophobic coating has excellent anti-corrosion capability in an H2S environment for 50 days and in a 3.5 % NaCl solution for 60 days. This is of great significance for developing the potential applications of superhydrophobic coatings in H2S environments.