Aims. We present a study of the environment of the Swift long gamma-ray burst GRB 120327A at z ≈ 2.8 through optical spectroscopy of its afterglow. Methods. We analyzed medium-resolution, multi-epoch spectroscopic observations (R ~ 7000−12 000, corresponding to ~15−23 km s-1, S/N = 15−30 and wavelength range 3000−25 000 Å) of the optical afterglow of GRB 120327A, taken with X-shooter at the VLT 2.13 and 27.65 hr after the GRB trigger. Results. The first epoch spectrum shows that the ISM in the GRB host galaxy at z = 2.8145 is extremely rich in absorption features, with three components contributing to the line profiles. The hydrogen column density associated with GRB 120327A has log NH/cm-2 = 22.01 ± 0.09, and the metallicity of the host ga...