The dead included two officers and six people believed to have been held captive in a house in Tlaquepaque, Jalisco state, the state prosecutor's office said.
Another man died on the street.
Jalisco has been hard-hit by violence linked to organized crime, particularly the powerful Jalisco New Generation drug cartel.
In the latest incident, the kidnappers opened fire on the officers and shot their captives when they were cornered, state prosecutor Gerardo Octavio Solis Gomez said.
After the gang shot at them, the agents returned fire and requested backup.
Dozens of police and elements of the army supported by two helicopters were deployed to begin a house to house search for the attackers.
a group of people riding on the back of a truck: Jalisco state has been been hard-hit by violence linked to organized crime in recent years
A woman who asked to remain anonymous said the man who was killed in the street was her 43-year-old brother who had gone to visit his daughter.
"They shot him in the heart, but he had nothing to do with it. He was already dead when I arrived," she said.
Around 300 assault rifle shells were scattered at the scene.
Neighbors described moments of panic during the shooting and the search operation.
"They banged on the door, the windows were broken. We weren't given a chance to go and open the door," a neighbor who identified herself as Gabriela told AFP, adding that officers went up on the rooftops.
In a nearby kindergarten, teachers followed safety protocols to protect the children.
"They grabbed the children and then laid them down on the ground, they had them all protected," Josefina, 40, told AFP.