CHIHUAHUA, Mexico (AP) _ Written off by some as a dying relic, Mexico's ruling party has rebounded with a dramatic election victory, reclaiming the governor's office in this northern border state.

``We transformed the PRI and the people responded,'' Chihuahua's Gov.-elect, Patricio Martinez, said Monday, referring to the Institutional Revolutionary Party by its Spanish initials.

It was the first time the PRI, which until a decade ago controlled every state in Mexico, has recaptured a state lost to an opposition party. And it was a major boost after a string of defeats _ including the loss of the PRI's majority in Congress last year.

The PRI also won the governor's race in north-central Durango state in Sunday's elections, but a leftist opposition candidate was the apparent victor in Zacatecas, another northern state.

Chihuahua state election officials said that with 75 percent of the vote counted, Martinez led Ramon Galindo of the conservative National Action Party by 341,247 votes to 276,048 _ 51 percent to 42 percent. Three other candidates split the rest.

The victory belies claims that the PRI would wither once out of power, at least on a state level. Created in 1929 to govern Mexico, the party historically has depended on handing out patronage to a network of labor, farm and social groups.

The Chihuahua state PRI was devastated when Francisco Barrio of National Action was elected governor in 1992 _ a victory fed by widespread belief that fraud had robbed him of the post six years earlier.

The PRI was forced to lay off hundreds of its workers, and new officials campaigned against corruption. They scoured state payrolls, firing hundreds of PRI activists who worked for the party rather than at their state jobs.

Deeply in debt, the PRI had so much trouble paying bills that power and phones were cut off to its state headquarters for a time.

Asked when the party began to rebound, spokesman Victor Alvidres joked: ``About two months ago.'' In fact, the party recaptured a majority in the state legislature in 1995.

The PRI maintained power nationally and had a strong statewide network of activists. National Action never managed to create a rival grassroots base. After decades of crusading against corruption, it also was tarnished by a few scandals gleefully publicized by the PRI.

For the first time, the PRI experimented with a primary open to voters of any party. Martinez, once mayor of the Chihuahua state capital, defeated Artemio Iglesias, whose years in Mexico City had made him popular with party leaders but little known locally.

President Ernesto Zedillo has said he would like to see a similar primary nationwide to choose the presidential candidate in 2000.

``I think the PRI won because of the popularity of its candidate,'' said Alberto Montoya, who voted for National Action in 1992 but displayed a Martinez poster in his shoe store window this year.

He said Galindo ``did not know how to solve problems'' as mayor of Ciudad Juarez.

In Zacatecas, the PRI's gubernatorial candidate suffered a stinging loss to the leftist Democratic Revolution Party.

Ricardo Monreal, once a federal congressman for the PRI, jumped to Democratic Revolution after PRI party leaders chose Jose Olvera Acevedo as their candidate for governor.

With 78 percent of the ballots counted, Monreal had 188,878 votes to Olvera's 158,724, state election officials said.

It was the leftist party's first gubernatorial victory, and it came in the north, where the party has been weak. Democratic Revolution received only about 5 percent of the votes in Chihuahua.

In Durango state, partial returns indicated the PRI's candidate, Angel Sergio Guerrero Mier, had easily won the governor's race.

The PRI did not accept defeat in any state until 1989. Since then it has lost Baja California, Chihuahua, Jalisco, Nuevo Leon, Guanajuato and Queretaro, all to National Action.