Classification of evoked or event-related potentials is an important prerequisite for many types of brain-computer interfaces (BCIs). To increase classification accuracy, spatial filters are used to improve the signal-to-noise ratio of the brain signals and thereby facilitate the detection and classification of evoked or event-related potentials. While canonical correlation analysis (CCA) has previously been used to construct spatial filters that increase classification accuracy for BCIs based on visual evoked potentials, we show in this paper, how CCA can also be used for spatial filtering of event-related potentials like P300. We also evaluate the use of CCA for spatial filtering on other data with evoked and event-related potentials and show that CCA performs consistently better than other standard spatial filtering methods.