We have determined the magnetic structure of the low-temperature incommensurate phase of multiferroic YMn2O5 using single-crystal neutron diffraction. By employing corepresentation analysis, we have ensured full compliance with both symmetry and physical constraints, so that the electrical polarization must lie along the b axis, as observed. The evolution of the spin components and propagation through the commensurate-incommensurate phase boundary points unambiguously at the exchange-striction mechanism as the primary driving force for ferroelectricity.