The brackish tidal marsh in the Baimaosha area of the Yangtze River Estuary was severely contaminated by 400 tons of heavy crude petroleum from a tanker that sank in December 2012. The spill accident led to severe environmental damage owing to its high toxicity, persistence and wide distribution. Microbial communities play vital roles in petroleum degradation in marsh sediments. Therefore, taxonomic analysis, high-throughput sequencing and 16S rRNA functional prediction were used to analyze the structure and function of microbial communities among uncontaminated (CK), lightly polluted (LP), heavily polluted (HP), and treated (TD) sediments. The bacterial communities responded with increased richness and decreased diversity when exposed to petroleum contamination. The dominant class changed from Deltaproteobacteria to Gammaproteobacteria after petroleum contamination. The phylum Firmicutes increased dramatically in oil-enriched sediment by 75.78%, 346.19% and 267.26% in LP, HP and TD, respectively. One of the suspected oil-degrading genera, Dechloromonas, increased the most in oil-contaminated sediment, by 540.54%, 711.27% and 656.78% in LP, HP and TD, respectively. Spore protease, quinate dehydrogenase (quinone) and glutathione-independent formaldehyde dehydrogenase, three types of identified enzymes, increased enormously with the increasing petroleum concentration. In conclusion, petroleum contamination altered the community composition and microorganism structure, and promoted some bacteria to produce the corresponding degrading enzymes. Additionally, the suspected petroleum-degrading genera should be considered when restoring oil-contaminated sediment.