Updated

A quick-count sampling of votes for governor of Mexico's most populous state gave a slight advantage to the candidate of President Enrique Pena Nieto's ruling party late Sunday, in a race seen as a key test ahead of next year's presidential election.

The preliminary results indicated Alfredo del Mazo of the Institutional Revolutionary Party, or PRI, was likely to win between 32.75 percent and 33.59 percent of the ballots in the State of Mexico, compared with 30.73 percent to 31.53 percent for his closest rival, Delfina Gomez of the leftist Morena party.

Pedro Zamudio, president of the state's Electoral Institute, said the forecast was based on representative sampling of voting stations that has 95 percent certainty — but he cautioned that it the outcome would not be final until all the ballots were counted.

An official count late in the evening had Gomez ahead with 32.3 percent of the votes, to 31.3 percent for del Mazo, but with only about 13 percent of the ballots tabulated.

A PRI victory would give the party a much-needed boost as the president's approval ratings have dipped near single digits ahead of the 2018 race for the nation's top office, which Pena Nieto cannot contest. But losing a state it has governed without interruption for 88 years would be a devastating blow a year after the PRI lost in several other states it had also always dominated.

The other two main parties, the leftist Democratic Revolution and the conservative National Action, were behind in the state by a significant margin.

Even before the quick-count results were announced, del Mazo and Gomez both proclaimed victory, something that happens commonly in Mexico.

"We are triumphing," del Mazo told supporters in the evening.

Morena leaders argued that the two top candidates were essentially in a statistical tie.

Andres Manuel Lopez Obrador, the standard-bearer of the Morena party, promptly rejected the quick count as a product of the "mafia of power" and urged supporters to gather electoral evidence to prove Gomez won.

"We are in the right," Lopez Obrador said in brief televised remarks. "Delfina won, and we are going to prove it. We will not accept any electoral fraud. ... Mexico needs democracy."

Lopez Obrador is preparing for what would be his third bid for the presidency next year, and observers have said a win by Gomez would be a big boost to his chances. Lopez Obrador lost in 2006 and 2012 and alleged fraud after both presidential races.

Zamudio estimated overall turnout in the state at just over 50 percent, up significantly from the last two gubernatorial ballots.

Voters in the states of Coahuila and Nayarit were also choosing new governors Sunday.

But Mexico State is the country's biggest electoral prize, with 11 million voters and substantial industry and influence in the area ringing the nation's capital. Control of the state can be key to a presidential campaign, giving the victorious party resources and a wealth of patronage jobs for backers.

Pena Nieto himself was governor of Mexico State before becoming president. So were the father and grandfather of Del Mazo, who is himself a distant cousin of the president — a fact often trumpeted by opponents hoping to capitalize on Pena Nieto's low popularity.

Losing there would be a "huge hit" to the PRI, said Jose Antonio Crespo, a political analyst at Mexico's Center for Economic Research and Teaching: "It would lose one of the most important bastions in terms of image, in terms of enthusiasm among PRI-ists."

Voting centers closed in the evening amid dueling accusations of vote buying, complaints that some voters received intimidating telephone calls warning them not to cast ballots and reports of bloody pig heads being left outside opposition party offices.

"We are tired of so much corruption, corrupt politicians, corrupt police," said Ruben Sanchez Mendoza, a 47-year-old shopkeeper in the sprawling Mexico City suburb of Ecatepec who backed Gomez. "The truth is, without a change, I don't see a future for ourselves or our children."

But at a polling station nearby, 65-year-old retiree Maria Concepcion Sanchez Morales said she was voting for the PRI despite claims by Morena that the ruling party gave away "rotten beans" to buy votes.

"They say they give out rotten beans, but at least they give out beans," she said. "Let's not lie: All the benefit programs come from the PRI."

Both agreed that crime, such as widespread robberies in the street and aboard public buses, was the most pressing issue. The state's Mexico City suburbs — some of them chaotic cities of 1 million or more in their own right — are plagued by violence, especially against women. Just this week authorities in Chalco found the burned bodies of a woman and two children in a grassy lot.

"We need new people, people really committed to citizens, who really apply the law, who give justice to the missing and murdered women in Ecatepec," said Francisca Anaya, a 52-year-old unemployed project manager. "The women of Ecatepec right now are defenseless. There is no one to protect us. At any moment they can kidnap, rape, disappear us."

___

Associated Press writer Mark Stevenson in Ecatepec, Mexico, contributed to this report.