We consider a family of translation-invariant quantum spin chains with nearestneighbor interactions and derive necessary and sufficient conditions for these systems to be gapped in the thermodynamic limit. More precisely, let ψ be an arbitrary two-qubit state. We consider a chain of n qubits with open boundary conditions and Hamiltonian Hn(ψ) which is defined as the sum of rank-1 projectors onto ψ applied to consecutive pairs of qubits. We show that the spectral gap of Hn(ψ) is upper bounded by 1/(n - 1) if the eigenvalues of a certain 2 × 2 matrix simply related to ψ have equal non-zero absolute value. Otherwise, the spectral gap is lower bounded by a positive constant independent of n (depending only on ψ). A key ingredient in the proof is a new operator inequality for the ground space projector which expresses a monotonicity under the partial trace. This monotonicity property appears to be very general and might be interesting in its own right. As an extension of our main result, we obtain a complete classification of gapped and gapless phases of frustration-free translation-invariant spin-1/2 chains with nearest-neighbor interactions.