Existing state-of-the-art methods that take a single RNA sequence and predict the corresponding RNA secondary structure are thermodynamic methods. These aim to predict the most stable RNA structure. There exists by now ample experimental and theoretical evidence that the process of structure formation matters and that sequences in vivo fold while they are being transcribed. None of the thermodynamic methods, however, consider the process of structure formation. Here, we present a conceptually new method for predicting RNA secondary structure, called CoFold, that takes effects of co-transcriptional folding explicitly into account. Our method significantly improves the state-of-art in terms of prediction accuracy, especially for long sequences of >1000 nt in length.