We report radio line observations of CO(1-0), 13CO(1-0), CS(5-4), CS(2-1), C34S(2-1), H13CO+(1-0), HCS+(2-1), and N2H+(1-0) and near-infrared spectroscopy (in the K, L, and M bands) of Z CMa and its surroundings. Our results show that the CS(2-1) cloud around Z CMa is in approximate virial equilibrium and has a mass of some 42 M☉. The CS(5-4), C34S(2-1), and H13CO+(1-0) data reveal a centrally condensed and flattened inner cloud core structure perpendicular to the CO(1-0) outflow, which has a dynamical timescale of some (2 × 103)-(1 × 104) yr. The mass of the CS(5-4) core is 8.0-15 M☉, which is close to the magnetic critical mass. Along the major axis of the CS(5-4) core there is a velocity gradient, which can be interpreted as a superposition of initial cloud rotation and infall. Evidence for an infalling inner cloud core with a temperature gradient, an r-1.5 density law, and an r-0.5 velocity law is provided by the redshifted self-absorption feature in the H13CO+ profile, present in a very compact region oriented perpendicularly to the CO(1-0) outflow of Z CMa. Motivated by these signs of infall in the inner cloud core, we probe with our observational data the inside-out collapse model of Shu and the predictions of Galli & Shu for the collapse of a magnetized cloud core.Our medium-resolution K-band spectrum shows besides the redshifted, very marginal Brγ line four vibrationally excited first-overtone CO band heads in absorption. The slopes seen in the K-band spectrum are intrinsic to the FU Orionis-type disk of Z CMa and suggest the presence of the vibration-rotation bands of water vapor, implying a temperature around 2000 K and a hydrogen nuclei density on the order of 1012 cm-3 at 2.2 μm. The likely cause of these water-band wings is the strong heating produced by the mass accretion through the inner disk onto the star. Our L band does not show the 3.08 μm water ice feature. Instead, our spectrum suggests the presence of a 2.9 μm feature, probably due to stretching vibrations of OH, or a shift of the water-ice band to 2.9 μm, caused by large grains when scattering dominates.