Local media reported some 30 shots had been fired at an event in the north of the capital, Quito. Video footage posted on social media showed Villavicencio getting into a car after the event, before the sound of apparent gunfire and screaming.
Ecuador's police and Interior Ministry did not respond to repeated requests for comment about the details of the killing, but outgoing President Guillermo Lasso confirmed police safely detonated a grenade left behind by the killers.
"This is a political crime, which has the character of terrorism, and we do not doubt that this murder is an attempt to sabotage the electoral process," Lasso said in a video statement past midnight local time, after meeting with security and electoral officials.
The attorney general's office said one suspect in the crime later died of injuries sustained in a shoot-out. The violence injured nine other people, including a candidate for the legislature and two police officers.
The office later said it had arrested six people so far in connection with the crime during raids in Quito.