The cerebral cortex is the main target of analysis in many functional magnetic resonance imaging (fMRI) studies. Since only about 20% of the voxels of a typical fMRI data set lie within the cortex, statistical analysis can be restricted to the subset of the voxels obtained after cortex segmentation. While such restriction does not influence conventional univariate statistical tests, it may have a substantial effect on the performance of multivariate methods. Here, we describe a novel approach for data-driven analysis of single-subject fMRI time series that combines techniques for the segmentation and reconstruction of the cortical surface of the brain and the spatial independent component analysis (sICA) of the functional time courses (TCs). We use the mesh of the white matter/gray matter boundary, automatically reconstructed from high-spatial-resolution anatomical MR images, to limit the sICA decomposition of a coregistered functional time series to those voxels which are within a specified region with respect to the cortical sheet (cortex-based ICA, or cbICA). We illustrate our analysis method in the context of fMRI blocked and event-related experimental designs and in an fMRI experiment with perceptually ambiguous stimulation, in which an a priori specification of the stimulation protocol is not possible. A comparison between cbICA and conventional hypothesis-driven statistical methods shows that cortical surface maps and component TCs blindly obtained with cblCA reliably reflect task-related spatiotemporal activation patterns. Furthermore, the advantages of using cbICA when the specification of a temporal model of the expected hemodynamic response is not straightforward are illustrated and discussed. A comparison between cblCA and anatomically unconstrained ICA reveals that - beside reducing computational demand - the cortex-based approach improves the fitting of the ICA model in the gray matter voxels, the separation of cortical components and the estimation of their TCs. particularly in the case of fMRI data sets with a complex spatiotemporal statistical structure.