Exact analytic calculations in spin-1/2 XY chains show the presence of long-time tails in the asymptotic dynamics of spatially inhomogeneous excitations. The decay of inhomogeneities for t→ϱ, is given in the form of a power law (t/ Q ) Ϫ Q , where the relaxation time Q and the exponent Q depend on the wave vector Q, characterizing the spatial modulation of the initial excitation. We consider several variants of the XY model ͑dimerized, with staggered magnetic field, with bond alternation, and with isotropic and uniform interactions͒, that are grouped into two families, whether the energy spectrum has a gap or not. Once the initial condition is given, the nonequilibrium problem for the magnetization is solved in closed form, without any other assumption. The long-time behavior for t→ϱ can be obtained systematically in a form of an asymptotic series through the stationary phase method. We found that gapped models show critical behavior with respect to Q, in the sense that there exist critical values Q c where the relaxation time Q diverges and the exponent Q changes discontinuously. At those points, a slowing down of the relaxation process is induced, similarly to phenomena occurring near phase transitions. Long-lived excitations are identified as incommensurate spin density waves that emerge in gapped systems, as a consequence of both approximate nesting of the spectrum and the degeneracy of some stationary points. In contrast, gapless models do not present the above anomalies as a function of the wave vector Q.