New algorithms for correlation analysis are presented that allow the mapping of brain activity from functional MRI (fMRI) data in real time during the ongoing scan. They combine the computation of the correlation coefficients between measured fMRI time-series data and a reference vector with "detrending", a technique for the suppression of non-stimulus-related signal components, and the "sliding-window technique". Using this technique, which limits the correlation computation to the last N measurement time points, the sensitivity to changes in brain activity is maintained throughout the whole experiment. For increased sensitivity in activation detection a fast and robust optimization of the reference vector is proposed, which takes into account a realistic model of the hemodynamic response function to adapt the parameterized reference vector to the measured data. Based on the described correlation method, real-time fMRI experiments using visual stimulation paradigms have been performed successfully on a clinical MR scanner, which was linked to an external workstation for image analysis.