ImportanceMelatonin has been shown to oppose several processes that are known to mediate age-related macular degeneration (AMD), but whether melatonin can confer benefits against AMD remains unclear.ObjectiveTo examine the association between melatonin supplementation and the risk of the development or progression of AMD.Design, Setting, and ParticipantsThis retrospective cohort study accessed data from TriNetX, a national database of deidentified electronic medical records from both inpatient and outpatient health care organizations across the US, between December 4, 2023, and March 19, 2024. Patients aged 50 years or older, 60 years or older, and 70 years or older with no history of AMD (AMD-naive group) and with a history of nonexudative AMD (nonexudative AMD group) were queried for instances of melatonin medication codes between November 14, 2008, and November 14, 2023. Patients were then classified into either a melatonin group or a control group based on the presence of medication codes for melatonin. Propensity score matching (PSM) was performed to match the cohorts based on demographic variables, comorbidities, and nonmelatonin hypnotic medication use.ExposureThe presence of at least 4 instances of melatonin records that each occurred at least 3 months apart.Main Outcomes and MeasuresAfter PSM, the melatonin and the control cohorts were compared to evaluate the risk ratios (RRs) and the 95% CIs of having an outcome. For the AMD-naive group, the outcome was defined as a new diagnosis of any AMD, whereas for the nonexudative AMD group, the outcome was progression to exudative AMD.ResultsAmong 121 523 patients in the melatonin-naive group aged 50 years or older (4848 in the melatonin cohort [4580 after PSM; mean (SD) age, 68.24 (11.47) years; 2588 female (56.5%)] and 116 675 in the control cohort [4580 after PSM; mean (SD) age, 68.17 (10.63) years; 2681 female (58.5%)]), melatonin use was associated with a reduced risk of developing AMD (RR, 0.42; 95% CI, 0.28-0.62). Among 66 253 patients aged 50 years or older in the nonexudative AMD group (4350 in the melatonin cohort [4064 after PSM; mean (SD) age, 80.21 (8.78) years; 2482 female (61.1%)] and 61 903 in the control cohort [4064 patients after PSM; mean (SD) age, 80.31 (8.03) years; 2531 female (62.3%)]), melatonin was associated with a reduced risk of AMD progression to exudative AMD (RR, 0.44; 95% CI, 0.34-0.56). The results were consistent among subsets of individuals aged 60 years or older (AMD-naive cohort: RR, 0.36 [95% CI, 0.25-0.54]; nonexudative AMD cohort: RR, 0.38 [95% CI, 0.30-0.49]) and 70 years or older (AMD-naive cohort: RR, 0.35 [95% CI, 0.23-0.53]; nonexudative AMD cohort: RR, 0.40 [95% CI, 0.31-0.51]).Conclusions and RelevanceMelatonin use was associated with a decreased risk of development and progression of AMD. Although lifestyle factors may have influenced this association, these findings provide a rationale for further research on the efficacy of using melatonin as a preventive therapy against AMD.