1α,25-Dihydroxyvitamin D3 signals via the vitamin D receptor (VDR). Higher serum vitamin D is associated with thinner primary melanoma and better outcome, although a causal mechanism has not been established. As patients with melanoma commonly avoid sun exposure, and consequent vitamin D deficiency might worsen outcomes, we interrogated 703 primary melanoma transcriptomes to understand the role of vitamin D–VDR signaling and replicated the findings in The Cancer Genome Atlas metastases. VDR expression was independently protective for melanoma-related death in both primary and metastatic disease. High tumor VDR expression was associated with upregulation of pathways mediating antitumor immunity and corresponding with higher imputed immune cell scores and histologically detected tumor-infiltrating lymphocytes. High VDR–expressing tumors had downregulation of proliferative pathways, notably Wnt/β-catenin signaling. Deleterious low VDR levels resulted from promoter methylation and gene deletion in metastases. Vitamin D deficiency (<25 nmol/L ∼ 10 ng/mL) shortened survival in primary melanoma in a VDR-dependent manner. In vitro functional validation studies showed that elevated vitamin D–VDR signaling inhibited Wnt/β-catenin signaling genes. Murine melanoma cells overexpressing VDR produced fewer pulmonary metastases than controls in tail-vein metastasis assays. In summary, vitamin D–VDR signaling contributes to controlling pro-proliferative/immunosuppressive Wnt/β-catenin signaling in melanoma and this is associated with less metastatic disease and stronger host immune responses. This is evidence of a causal relationship between vitamin D–VDR signaling and melanoma survival, which should be explored as a therapeutic target in primary resistance to checkpoint blockade.