The real-time stress evolution during reactive dc magnetron sputter deposition of TiN films in Ar+N2 plasma discharge was measured in situ using a multiple-beam optical stress sensor, while the film texture was determined ex situ using x-ray diffraction. The influence of atomic N/Ti flux and energy flux, previously quantified by combining plasma characterization and Monte Carlo simulations (2009 J. Phys. D: Appl. Phys. 42 053002), was investigated by varying either the N2 partial pressure at fixed total pressure, the total working pressure or the bias voltage applied to the substrate. The contribution of thermal stress was carefully taken into account from thermal probe measurements to evaluate the intrinsic (growth) stress from the measured film force data. A clear correlation between stress, film texture and energy flux is evidenced: while underdense (1 1 1)-textured TiN films with ‘V’-shaped columnar growth (zone T) are under tensile stress (up to +0.6 GPa), dense TiN films with zone II microstructure develop a (0 0 2) texture and large compressive stress (up to 3 GPa) when the energy flux is higher than ∼150 eV per incoming particle. However, it is shown that a positive or negative bias voltage, though increasing the energy flux, did not promote a (0 0 2) texture. It is concluded that compressive stress development and (0 0 2) preferential growth are both kinetically driven processes in magnetron sputtered TiN layers, but exhibit distinct dependence with the substrate fluxes.