We report the observation of the rare charm decay $D^0\rightarrow
K^-\pi^+e^+e^-$, based on 468 fb$^{-1}$ of $e^+e^-$ annihilation data collected at or close to the center-of-mass energy of the $Y(4S)$resonance with the BaBar detector at the SLAC National Accelerator Laboratory. We find the branching fraction in the invariant mass range $0.675< m(e^+e^-) < 0.875$ $GeV/c^2$ of the electron pair to be ${\cal
B}(D^0\rightarrow K^-\pi^+e^+e^-) = (4.0\pm0.5\pm0.2\pm0.1) \times
10^{-6}$, where the first uncertainty is statistical, the second systematic, and the third due to the uncertainty in the branching fraction of the decay $D^0\rightarrow K^-\pi^+\pi^+\pi^-$ used as a normalization mode. The significance of the observation corresponds to 9.7 standard deviations including systematic uncertainties. This result is consistent with the recently reported $D^0\rightarrow
K^-\pi^+\mu^+\mu^-$ branching fraction, measured in the same invariant mass range, and with the value expected in the Standard Model.