  We present the first comparison of observed stellar continuum spectra of
high-redshift galaxies and mock galaxy spectra generated from hydrodynamical
simulations. The mock spectra are produced from the IllustrisTNG TNG100
simulation combined with stellar population models and take into account dust
attenuation and realistic observational effects (aperture effects and noise).
We compare the simulated $D_n4000$ and EW(H$\delta$) of galaxies with $10.5
\leq \log(M_\ast/M_\odot) \leq 11.5$ at $0.6 \leq z \leq 1.0$ to the observed
distributions from the LEGA-C survey. TNG100 globally reproduces the observed
distributions of spectral indices, implying that the age distribution of
galaxies in TNG100 is generally realistic. Yet there are small but significant
differences. For old galaxies, TNG100 shows small $D_n4000$ when compared to
LEGA-C, while LEGA-C galaxies have larger EW(H$\delta$) at fixed $D_n4000$.
There are several possible explanations: 1) LEGA-C galaxies have overall older
ages combined with small contributions (a few percent in mass) from younger
($<1$~Gyr) stars, while TNG100 galaxies may not have such young
sub-populations; 2) the spectral mismatch could be due to systematic
uncertainties in the stellar population models used to convert stellar ages and
metallicities to observables. In conclusion, the latest cosmological galaxy
formation simulations broadly reproduce the global age distribution of galaxies
at $z\sim1$ and, at the same time, the high quality of the latest observed and
simulated datasets help constrain stellar population synthesis models as well
as the physical models underlying the simulations.
