Electrical stimulation is a widely used and effective tool in systems neuroscience, neural prosthetics, and clinical neurostimulation. However, electrical artifacts evoked by stimulation significantly complicate the detection of spiking activity on nearby recording electrodes. Here, we present ERAASR: an algorithm for Estimation and Removal of Artifacts on Arrays via Sequential principal components Regression. This approach leverages the similar structure of artifact transients, but not spiking activity, across simultaneously recorded channels on the array, across pulses within a train, and across trials. The effectiveness of the algorithm is demonstrated in macaque dorsal premotor cortex using acute linear multielectrode array recordings and single electrode stimulation. Large electrical artifacts appeared on all channels during stimulation. After application of ERAASR, the cleaned signals were quiescent on channels with no spontaneous spiking activity, whereas spontaneously active channels exhibited evoked spikes which closely resembled spontaneously occurring spiking waveforms. The ERAASR algorithm requires no special hardware and comprises sequential application of straightforward linear methods with intuitive parameters. Enabling simultaneous electrical stimulation and multielectrode array recording can help elucidate the causal links between neural activity and cognitive functions and enable the design and implementation of novel sensory protheses.