The flux-line lattice in the compound ErNi2B2C, which has a tendency to ferromagnetic order in the a-b plane, is studied with the external magnetic field direction close to the c axis. We show the existence of an instability, where the direction of flux lines spontaneously tilts away from that of the applied field as a prelude to the onset of ferromagnetic order and the predicted spontaneous vortex phase. This tilting instability is accompanied by a decreasing longitudinal correlation length of the flux lattice, as observed.