MEXICO CITY — The ruling party’s candidate held a slight advantage in preliminary vote counts on Monday in the race for governor of Mexico’s most populous state, an election seen as a key test ahead of next year’s presidential election.
With about 97 percent of votes counted, Alfredo del Mazo of the Institutional Revolutionary Party, or PRI, had won 33.7 percent of the votes in Mexico State, compared with 30.8 percent for his closest rival, Delfina Gomez of the leftist Morena party.
Mexico State surrounds Mexico City, and includes many of its suburbs and outlying slums. Final ballot counts are expected by Wednesday.
A PRI victory would hand the party a lifeline, after President Enrique Pena Nieto’s approval ratings dipped to near single digits and a parade of former PRI governors were jailed for corruption.
Many believed the party would have been essentially knocked out of the 2018 presidential race if it failed to hold on to its last big bastion, Pena Nieto’s home state and one it has governed without interruption for 88 years.
But if Del Mazo wins, he will face a state where two-thirds of voters opposed him.
Political analyst Raymundo Riva Palacio said such a narrow, ‘‘pyrrhic’’ PRI victory in the state of Mexico could spell trouble for the party next year.
Considering the power of the PRI’s political machine in the state and the fact that Gomez was practically unknown eight months ago, the result so far signals ‘‘an enormous discontent with the PRI’’ and portends a ‘‘very bad scenario’’ for the party and the president, he argued.
Jose Antonio Crespo, a political analyst at Mexico’s Center for Economic Research and Teaching, said that with the bruising elections in Mexico State the PRI ‘‘is not going to win any more prestige or recover its lost credibility. On the contrary, the PRI insists on playing dirty.’’
‘‘As far as 2018 is concerned, they lost prestige, it sends a very bad signal for 2018,’’ he noted.
The other two main parties, the leftist Democratic Revolution and the conservative National Action, were behind in the state by significant margins.
But the Mexico State elections will also be a test for Gomez, the hand-picked candidate of Morena party leader and 2018 presidential hopeful Andres Manuel Lopez Obrador.
If Gomez’ campaign holds protests in Mexico State, it could stir up memories of Lopez Obrador’s unpopular decision to block streets in Mexico City for months in 2006 to protest perceived vote fraud in his narrow loss in the presidential race.
On Monday, Lopez Obrador said Gomez’ campaign may demand a recount.
‘‘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.’’