The victims, all male, were blindfolded and gagged and had been shot in the head, said Edgar Millan, a spokesman with the federal Public Safety Department, at a news conference in Tijuana.
Soldiers, state and local police were sent in to help control the firefight that began when federal agents prepared to raid a house near the U.S. border that police now say was a shelter for a cell of the Arellano Felix drug cartel.
Three nearby schools were evacuated, and television showed police running with small children in their arms while shots rang out.
Millan said the shootout killed one gunman and wounded four officers, in the latest outbreak of violence across the border from San Diego.
Four gunmen were arrested - one is a state police investigator and another a Tijuana police officer, he said. The four men will be flown to Mexico City for questioning.
Millan said officials recovered 11 automatic rifles and three bulletproof vests inside the house.
Already this week, gunmen shot and killed eight people in Tijuana, including two local police officers, as well as a district commander, his wife and his 12-year-old daughter.
Also Thursday, employees at Tijuana's City Hall and police headquarters were evacuated after receiving death threats over a police radio frequency, said Abraham Sarabia, a spokesman for city police.
Mexico has seen a spike in gang-related killings since the beginning of the year. The Mexican government has described the violence as revenge for President Felipe Calderon's year-old crackdown on organized crime that sent thousands of soldiers and federal police into violence-plagued cities nationwide.
In the central Mexican state of Hidalgo on Wednesday, assailants killed the director of public safety for the town of Tulancingo.
Jose Alvarado was shot more than 20 times, Hidalgo state police director Ahuizotl Figueroa said.
© MVIII The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed