Forecasting the geomagnetic effects of solar storms, known as coronal mass ejections (CMEs), is currently severely limited by our inability to predict the magnetic field configuration in the CME magnetic core and by observational effects of a single spacecraft trajectory through its 3-D structure. CME magnetic flux ropes can lead to continuous forcing of the energy input to the Earth's magnetosphere by strong and steady southward-pointing magnetic fields. Here we demonstrate in a proof-of-concept way a new approach to predict the southward field B z in a CME flux rope. It combines a novel semiempirical model of CME flux rope magnetic fields (Three-Dimensional Coronal ROpe Ejection) with solar observations and in situ magnetic field data from along the Sun-Earth line. These are provided here by the MESSENGER spacecraft for a CME event on 9-13 July 2013. Three-Dimensional Coronal ROpe Ejection is the first such model that contains the interplanetary propagation and evolution of a 3-D flux rope magnetic field, the observation by a synthetic spacecraft, and the prediction of an index of geomagnetic activity. A counterclockwise rotation of the left-handed erupting CME flux rope in the corona of 30° and a deflection angle of 20° is evident from comparison of solar and coronal observations. The calculated Dst matches reasonably the observed Dst minimum and its time evolution, but the results are highly sensitive to the CME axis orientation. We discuss assumptions and limitations of the method prototype and its potential for real time space weather forecasting and heliospheric data interpretation.