Context : High spectral resolution X-ray observations of classical T Tauri stars ( CTTSs ) demonstrate the presence of plasma at T \sim 2 - 3 \times 10 ^ { 6 } K and n _ { e } \sim 10 ^ { 11 } -10 ^ { 13 } cm ^ { -3 } , unobserved in non-accreting stars . Stationary models suggest that this emission is due to shock-heated accreting material , but they do not allow to analyze the stability of such material and its position in the stellar atmosphere . Aims : We investigate the dynamics and the stability of shock-heated accreting material in classical T Tauri stars and the role of the stellar chromosphere in determining the position and the thickness of the shocked region . Methods : We perform 1-D hydrodynamic simulations of the impact of the accretion flow onto chromosphere of a CTTS , including the effects of gravity , radiative losses from optically thin plasma , thermal conduction and a well tested detailed model of the stellar chromosphere . Here we present the results of a simulation based on the parameters of the CTTS MP Mus . Results : We find that the accretion shock generates an hot slab of material above the chromosphere with a maximum thickness of 1.8 \times 10 ^ { 9 } cm , density n _ { e } \sim 10 ^ { 11 } -10 ^ { 12 } cm ^ { -3 } , temperature T \sim 3 \times 10 ^ { 6 } K and uniform pressure equal to the ram pressure of the accretion flow ( \sim 450 dyn cm ^ { -2 } ) . The base of the shocked region penetrates the chromosphere and stays where the ram pressure is equal to the thermal pressure . The system evolves with quasi-periodic instabilities of the material in the slab leading to cyclic disappearance and re-formation of the slab . For an accretion rate of \sim 10 ^ { -10 } M _ { \sun } yr ^ { -1 } , the shocked region emits a time-averaged X-ray luminosity L _ { X } \approx 7 \times 10 ^ { 29 } erg s ^ { -1 } , which is comparable to the X-ray luminosity observed in CTTSs of the same mass . Furthermore , the X-ray spectrum synthesized from the simulation matches in detail all the main features of the O viii and O vii lines of the star MP Mus . Conclusions :