Isaias Carrasco, 42, a former Socialist representative was killed Friday in the town of Arrasate by gunman suspected of belonging to the Basque militant group ETA.
Socialist candidate for prime minister José Luis Rodríguez Zapatero criticized the killing, The New York Times reported.
"Today, terrorists tried to interfere in the peaceful demonstration of the will of the people as they go to the polls," Zapatero said during a televised statement. "We will not permit it today. We will never permit it."
Zapatero canceled a final campaign appearance scheduled for Friday night in the Madrid suburb of Leganes.
Meanwhile, Mariano Rajoy, the conservative candidate, canceled rallies in Seville and Madrid.
The assassination came just ahead of the fourth anniversary of the March 11, 2004, bombing of the Madrid commuter train system, which left 191 people dead.