We study the cohomology groups with Z 2 -coefficients for compact flat Riemannian manifolds of diagonal type M Γ = Γ ∖ R n by explicit computation of the differentials in the Lyndon–Hochschild–Serre spectral sequence. We obtain expressions for H j ( M Γ , Z 2 ) , j = 1 , 2 and give an effective criterion for the non-vanishing of the second Stiefel–Whitney class w 2 ( M Γ ) . We apply the results to exhibit isospectral pairs with special cohomological properties; for instance, we give isospectral 5-manifolds with different H 2 ( M Γ , Z 2 ) , and isospectral 4-manifolds M , M ′ having the same Z 2 -cohomology where w 2 ( M ) = 0 and w 2 ( M ′ ) ≠ 0 . We compute the Z 2 -cohomology of all generalized Hantzsche–Wendt n -manifolds for n = 3 , 4 , 5 and we study H 2 and w 2 for a large n -dimensional family, K n , with explicit computation for a subfamily of examples due to Lee and Szczarba.