Soil microorganisms surviving in mining sites have developed metalresistance mechanisms to biotransform metals. Their use as biofertilizers can improve phytoremediation efficiency in contaminated soils by reducing metal toxicity while promoting plant growth. We analysed through wholemetagenome shotgun sequencing the composition, diversity and function of microbial communities present in a contaminated mine soil along a gradient of metals (As, Cu, Fe, Mn, Pb, Zn) to identify tolerant species carrying metal-resistance functional genes that can be used in association with plants for phytoremediation. Soil samples were collected from an abandoned copper mine, across three areas with different levels of metal contamination (unaffected, moderately contaminated and highly contaminated). The relative abundance of Proteobacteria, especially genus Bradyrhizobium, increased in the highly contaminated area, whereas Actinobacteria dominated in the unaffected area. Archaea (Euryarchaeota) predominated in the moderately contaminated area, Haloarcula, Halobacterium and Halorubrum being the most abundant genera. The fungi Basidiomycota did not exhibit differences among the areas, whereas Ascomycota, especially the genus Aspergillus, increased in areas with low metal concentrations. Metal-resistance genes associated with Fe (acn, furA, dpsA), Cu (cop-unnamed, copF, actP, copA, mmco, cutO) and As (arsT, arsC, aioA/aoxB) metabolism were the most abundant and were affected by the gradient of soil contamination. Those associated with Cu predominated in the most contaminated area, whereas As and Fe genes were more abundant in the least contaminated. Among the carriers of these metal-resistance genes, Bradyrhizobium diazoefficiens, Pseudomonas aeruginosa, Halorubrum trapanicum, Aspergillus fumigatus and A. fischeri were dominant in the most contaminated area. These species could give rise to promising biofertilizers to be used in association with suitable plants for the phytoremediation of contaminated mining sites.