Bacteria have many voltage- and ligand-gated ion channels, and population-level measurements indicate that membrane potential is important for bacterial survival. However, it has not been possible to probe voltage dynamics in an intact bacterium. Here we developed a method to reveal electrical spiking in Escherichia coli. To probe bacterial membrane potential, we engineered a voltage-sensitive fluorescent protein based on green-absorbing proteorhodopsin. Expression of the proteorhodopsin optical proton sensor (PROPS) in E. coli revealed electrical spiking at up to 1 hertz. Spiking was sensitive to chemical and physical perturbations and coincided with rapid efflux of a small-molecule fluorophore, suggesting that bacterial efflux machinery may be electrically regulated.