Tight junctions (TJs) are the key determinant of barrier function in the mammary gland, with their disruption being associated with the pathogenesis and progression of mastitis, especially in the case of Staphylococcus aureus (S. aureus) infection. This study investigated whether selenium (Se) could attenuate S. aureus-induced mastitis by inhibiting inflammation and protecting mammary gland TJs in mice. The expression profiles of S. aureus-infected gland tissues derived from the gene expression omnibus dataset were analyzed. We found cytokine production, cell junctions, the nuclear transcription factor-κB (NF-κB) signalling pathway, and inflammatory responses associated with the differentially expressed genes, as revealed by Gene Ontology (GO) and Kyoto Encyclopaedia of Genes and Genomes (KEGG) enrichment analyses. Se reduced the mRNA expression and production of inflammatory cytokines, including tumour necrosis factor-α (TNF-α) and interleukin-6 (IL-6), and decreased phosphorylation levels of the NF-κB complex. Moreover, Se alleviated structural damage and microvillus injury in mammary glands. Immunohistochemical staining revealed that Se increased the expression of Claudin-3; Western blot analysis revealed increased protein levels of Occludin and Tricellulin in the group supplemented with dietary Se. In summary, Se counteracted TJ disruption and attenuated NF-κB-mediated inflammatory responses in S. aureus-infected mouse mammary glands.