Non-spherical particles are known to orient preferentially in near-wall turbulence, but rod-like and disk-like particles align themselves differently relative to the mean vorticity direction. To uncover the mechanism that gives rise to such preferential particle orientations in anisotropic turbulence, Lagrangian statistics from a channel-flow simulation have been analysed. Ni et al. (J. Fluid Mech., vol. 743, 2014, R3) showed that the fluid vorticity and long rods independently aligned with the Lagrangian fluid stretching direction in isotropic turbulence. Following their approach, we deduced the left Cauchy–Green strain tensor along Lagrangian trajectories of tracer spheroids in channel-flow turbulence. The results showed that the alignment of the fluid vorticity vector with the strongest Lagrangian stretching direction in the channel centre, just as in isotropic turbulence, vanished in the vicinity of the walls. The analysis revealed that the directions of the strongest Lagrangian stretching and compression in near-wall turbulence are in the streamwise and wall-normal directions, respectively. All over the channel we found that the symmetry axis of prolate spheroids aligned with the direction of strongest Lagrangian stretching whereas oblate spheroids oriented with the direction of Lagrangian compression. This finding is apparently universal since the same trends were found in highly anisotropic wall turbulence as well as in isotropic turbulence. Contrary to the prevailing view, we have shown for the first time that the preferential orientation of the symmetry axis of long rods in the streamwise direction and of flat disks in the wall-normal direction is caused by Lagrangian stretching and not by fluid rotation. This finding fills a gap in our understanding of orientation and rotation of tracer spheroids in anisotropic wall turbulence.