Literature regarding the impacts of heavy metal exposure on erectile dysfunction (ED) is scarce. We aimed to evaluate the correlation between 10 urinary metals and ED in a large, nationally representative adult male sample. The dataset was extracted from the National Health and Nutrition Examination Survey (NHANES) during the period of 2001-2002 and 2003-2004. Weighted proportions and multivariable logistic regression analysis adjusted for confounding variables were utilized to determine the relationship between metal exposure and ED. Weighted quantile sum (WQS) regression was utilized to evaluate the impact of a mixture of urinary metals on ED. A total of 1328 participants were included in our study. In multivariable logistic regression analysis, cobalt (Co) and antimony (Sb) were positively associated with ED (odds ratio [OR]: 1.36, 95% confidence interval [CI]: 1.10-1.73, P = 0.020; and OR: 1.41, 95% CI: 1.12-1.77, P = 0.018, respectively) after full adjustment. Men in tertile 4 for Co (OR: 1.49, 95% CI: 1.02-2.41, P for trend = 0.012) and Sb (OR: 1.53, 95% CI: 1.08-2.40, P for trend = 0.041) had significantly higher odds of ED than those in tertile 1. Furthermore, the WQS index was significantly linked with increased odds of ED after full adjustment (OR: 1.31, 95% CI: 1.04-1.72, P < 0.05). Our study expanded on previous literature indicating the possible role of heavy metal exposure in the etiology of ED. The evaluation of heavy metal exposure should be included in the risk assessment of ED.