Ghrelin is a multi-functional polypeptide with cardiovascular protective effects. We aimed to explore whether the cardioprotective effect of ghrelin is mediated by inhibiting myocardial endoplasmic reticulum stress (ERS). A Langendorff model of isolated rat heart was used with ischemia/reperfusion (I/R; 40/120 min). Cardiac function was monitored, and histomorphologic features, degree of myocardial injury, level of ERS markers, and number of apoptotic cardiomyocytes were determined. Compared with control group, the I/R group showed significantly decreased cardiac function, seriously damaged myocardial tissue, increased number of apoptotic cells, and overexpression of mRNA and protein of ERS markers. However, preadministration of ghrelin in vivo (10−8 mol/kg, intraperitoneal injection, every 12 h, twice in all) greatly ameliorated the damaged heart function, attenuated myocardial injury and apoptosis, and decreased the expression of ERS markers: it decreased the mRNA and protein levels of glucose-regulated protein78 (GRP78) and C/EBP homologous protein (CHOP), with reduced caspase-12 protein expression. Furthermore, in vitro, ghrelin directly inhibited the myocardial ERS response induced by tunicamycin or dithiothreitol in rat cardiac tissue. Ghrelin could protect the heart against I/R injury, at least in part, through inhibiting myocardial ERS.