Glycoprotein nonmetastatic melanoma protein B (GPNMB) is a type I transmembrane protein initially identified in nonmetastatic melanomas and has been associated with human heart failure; however, its role in cardiac injury and function remains unclear. Here we show that GPNMB expression is elevated in failing human and mouse hearts after myocardial infarction (MI). Lineage tracing and bone-marrow transplantation reveal that bone-marrow-derived macrophages are the main source of GPNMB in injured hearts. Using genetic loss-of-function models, we demonstrate that GPNMB deficiency leads to increased mortality, cardiac rupture and rapid post-MI left ventricular dysfunction. Conversely, increasing circulating GPNMB levels through viral delivery improves heart function after MI. Single-cell transcriptomics show that GPNMB enhances myocyte contraction and reduces fibroblast activation. Additionally, we identified GPR39 as a receptor for circulating GPNMB, with its absence negating the beneficial effects. These findings highlight a pivotal role of macrophage-derived GPNMBs in post-MI cardiac repair through GPR39 signaling.