Aims. The aim of this work was to perform a multiphase spectroscopic study of W Vir which represents stars of the class of population II Cepheids, in order to trace the behaviour of emission features in different lines, and to use the data to describe the dynamical processes in the atmosphere of this star associated with the shock wave propagation. Methods. Our spectroscopic study of W Vir involved 18 high-resolution spectra obtained with the help of 3.5-m telescope of Apache Point Observatory. These spectra cover W Vir's pulsational cycle with good phase resolution that enabled us to precisely fix the intervals of appearance, existence and disappearance of many anomalous spectral features, as well as to construct their radial velocity curves. Results. We detected and investigated the behaviour of emission and line doubling in many metallic lines (Na I, Fe I, Fe II, Ba II etc), as well as in hydrogen and helium lines. Analysis of the temporal characteristics of those emission features allowed us to make, in particular, the following conclusion. Conclusions. W Vir consists of two parts: the inner part, which is, in fact, a pulsating star itself with periodic shocks penetrating into the upper atmosphere, an outer one -a circumstellar envelope. The interaction of the main shock wave with the infalling envelope layers can explain the observed peculiarities of the spectral line variability.