  We introduce a method based on matrix product states (MPS) for computing
spectral functions of (quasi) one-dimensional spin chains, working directly in
momentum space in the thermodynamic limit. We simulate the time evolution after
applying a momentum operator to an MPS ground state by working with the
momentum superposition of a window MPS. We show explicitly for the spin-1
Heisenberg chain that the growth of entanglement is smaller in momentum space,
even inside a two-particle continuum, such that we can attain very accurate
spectral functions with relatively small bond dimension. We apply our method to
compute spectral lineshapes of the gapless XXZ chain and the square-lattice
J1-J2 Heisenberg model on a six-leg cylinder.
