Autophagy is an important mechanism for cellular homeostasis and survival during pathologic stress conditions in the kidney, such as ischemia‐reperfusion (IR) injury. In this study, renal IR was induced in female C57BL/6 mice after melatonin administration. Renal function, histological damage, inflammatory infiltration, cytokine production, oxidative stress, antioxidant capacity, autophagy changing, apoptosis levels, and autophagy‐associated intracellular signaling pathway were assessed to evaluate the impact of antecedent melatonin treatment on IR‐induced renal injury. The administration of melatonin resulted in significantly preserved renal function, and the protective effect was associated with ameliorated oxidative stress, limited pro‐inflammatory cytokine production, and neutrophil and macrophage infiltration. Moreover, autophagic flux was increased after melatonin administration while the apoptosis levels were decreased in the melatonin‐pretreated mice. Using TAK‐242 and CRX‐527, we confirmed that MyD88‐dependent TLR4 and MEK/ERK/mTORC1 signaling participated in melatonin‐induced autophagy in IR mice. Collectively, our results provide novel evidence that antecedent melatonin treatment provides protection for the kidney against IR injury by enhancing autophagy, as regulated by the TLR4/MyD88/MEK/ERK/mTORC1 signaling pathway. Therefore, melatonin preconditioning offers a potential therapeutic approach to prevent renal IR injury related to various clinical conditions.