Contrast-induced nephropathy (CIN) is an iatrogenic acute renal failure occurring following the intravascular injection of iodinated radiographic contrast medium. However, the regulatory mechanisms for CIN remain to be fully elucidated. The present study aimed to investigate whether atorvastatin protects against CIN via anti-apoptotic effects by the upregulation of Hsp27 in vivo and in vitro. To determine whether atorvastatin attenuated CIN, the inflammatory response and apoptosis in vivo and in vitro, a rat model of iopamidol-induced CIN was used, and human embryonic proximal tubule (HK2) cell damage was assessed. The rats were assigned into four groups (n=10 per group), as follows: Control rats; rats+atorvastatin; rats+iopamidol; rats+iopamidol+atorvastatin. In vitro, the HK2 cells were treated with iopamidol in the presence or absence of atorvastatin, heat shock protein (Hsp) 27 small interfering (si) RNA or pcDNA3.1-Hsp27. The renal tissues were examined histopathologically and collected for western blot analysis. The results showed that atorvastatin ameliorated the apoptosis and deterioration of renal function (P<0.05). Furthermore, atorvastatin reduced the iopamidol-induced activity of B cell lymphoma-2 (Bcl-2)-associated X protein (Bax)/caspase-3 and increased the expression of Bcl-2 in vivo and in vitro. Notably, following treatment with Hsp27 siRNA or pcDNA3.1-Hsp27, it was found that iopamidol enhanced or weakened the upregulation of Bax/caspase-3 and downregulation of Bcl-2 in the HK2 cells, respectively. The results of the present study suggested that atorvastatin protected against contrast-induced renal tubular cell apoptosis through the upregulation of Hsp27 in vivo and in vitro.