Functional magnetic resonance imaging (fMRI) is one of the most widely used methods to study neuronal activity in human brain in vivo. A data-driven method is proposed to detect both the temporal and spatial information in fMRI data acquired during the representation of stimuli, which may also be applied when the expected response cannot be estimated a priori. The method is built on the existing temporal clustering analysis technique with additional features of searching for the connected components in the temporal and spatial domains in the whole brain. Moreover, no pre-defined assumptions about the stimuli are required in comparison to the previous methods. The output contains the information on how long the activation sustains and where the corresponding voxels are. For validation, the method has been applied to four sets of data from an experiment involving visual stimuli. Our method is able to detect the response to the stimuli.