TbMnO3 is an orthorhombic insulator where incommensurate spin order for temperature TN<41 K is accompanied by ferroelectric order for T<28 K. To understand this, we establish the magnetic structure above and below the ferroelectric transition using neutron diffraction. In the paraelectric phase, the spin structure is incommensurate and longitudinally modulated. In the ferroelectric phase, however, there is a transverse incommensurate spiral. We show that the spiral breaks spatial inversion symmetry and can account for magnetoelectricity in TbMnO3.