Sepsis-induced myocardial dysfunction is one of the features of multiple organ dysfunction in sepsis, which is associated with extremely high mortality and is characterized by impaired myocardial compliance. To date, there are few effective treatment options available to cure sepsis. Tannic acid (TA) is reportedly protective during sepsis; however, the underlying mechanisms by which TA protects against septic heart injury remain elusive. The present study investigated the potential effects and underlying mechanisms of TA in alleviating lipopolysaccharide (LPS)-induced H9C2 cardiomyocyte cell apoptosis. H9C2 cells were treated with LPS (15 µg/ml), TA (10 µM) and TA + LPS; control cells were treated with medium only. Apoptosis was measured using flow cytometry, reverse transcription-quantitative PCR (RT-qPCR) and western blot analysis. Additionally, the levels of cellular reactive oxygen species (ROS), malondialdehyde and nicotinamide adenine dinucleotide phosphate were evaluated. Western blotting and RT-qPCR were also employed to detect the expression levels of endoplasmic reticulum (ER) stress-associated functional proteins. The present findings demonstrated that TA reduced the degree of LPS-induced H9C2 cell injury, including inhibition of ROS production and ER stress (ERS)-associated apoptosis. ERS-associated functional proteins, including activating transcription factor 6, protein kinase-like ER kinase, inositol-requiring enzyme 1, spliced X box-binding protein 1 and C/EBP-homologous protein were suppressed in response to TA treatment. Furthermore, the expression levels of ERS-associated apoptotic proteins, including c-Jun N-terminal kinase, Bax, cytochrome c, caspase-3, caspase-12 and caspase-9 were reduced following treatment with TA. Additionally, the protective effects of TA on LPS-induced H9C2 cells were partially inhibited following treatment with the ROS inhibitor N-acetylcysteine, which demonstrated that ROS mediated ERS-associated apoptosis and TA was able to decrease ROS-mediated ERS-associated apoptosis. Collectively, the present findings demonstrated that the protective effects of TA against LPS-induced H9C2 cell apoptosis may be associated with the amelioration of ROS-mediated ERS. These findings may assist the development of potential novel therapeutic methods to inhibit the progression of myocardial cell injury.