Twenty people - 17 men and three women - were killed in the attack in Las Tinajas, in Michoacán state.
Investigators said the assailants, who were dressed in camouflage gear, entered the ranch in the chip van while another vehicle blocked the entrance.
President Andrés Manuel López Obrador blamed gang rivalry for the shooting.
"It was a massacre of one group by another," he said at a news conference.
Nineteen people died at the scene and another on his way to hospital.
The 59-year-old owner of the venue and his son were among those killed. Four people were also injured.
More than 100 casings were found at the scene.
The gunmen left behind the chip van, which had been reported stolen last week, and fled in faster cars, a statement by the Michoacán attorney-generals office said.
Investigators said that they found gang logos in one of the cars parked at the venue, which led them to believe that among those attending the cockfight were members of a criminal group.
A number of criminal gangs operate in the region and bloody attacks on gatherings of rivals have become increasingly common.
In recent months, gunmen in various regions of Mexico have targeted funerals and wakes as well as bars and clubs in their attempt to take out as many of their rivals at one time as they can.
The area around Las Tinajas is disputed by a number of gangs which engage in the smuggling of stolen petrol and the illegal tapping of petrol pipes owned by the state-run oil company.