By Dave Graham MEXICO CITY, July 4 (Reuters) - A year after winning the Mexican presidency, Enrique Pena Nieto needs a solid performance by the opposition in state elections on Sunday to keep alive a fragile alliance he built to steer reforms through Congress. Falling short of a majority when he won, Pena Nieto crafted an informal coalition with the opposition to help realize his economic vision, two key parts of which - opening up state oil giant Pemex to private capital and boosting the tax take - he is planning to send to Congress by September. That accord, known as the Pact for Mexico, has yielded a major education shake-up and a landmark bill to spur more competition in the telecommunications industry - but it has also given the opposition leverage over the government. Anxious to preserve their autonomy, opposition leaders have kept up a steady barrage of criticism on Pena Nieto's Institutional Revolutionary Party, or PRI, accusing it of seeking to steal or buy its way to victory on July 7. Throughout, both the conservative National Action Party, or PAN, and the leftist Party of the Democratic Revolution (PRD) have threatened to quit the pact if the PRI does not play fair. "If the elections don't look clean, there's no question it's going to be very difficult to maintain the pact," said Gabriela Cuevas, a senator for the PAN. Fourteen of Mexico's 31 federal states hold elections for a mix of local parliaments and municipal governments, but the only state governorship up for grabs is Baja California, a region of particular importance to the PAN, Mexico's former rulers. In 1989, Baja California was the first state the PAN captured and it became a major stepping stone for the party en route to ending 71 consecutive years of PRI rule in 2000. The PAN still holds the border state, but since Pena Nieto reclaimed the presidency last year, the party has been mired in internal squabbling that has shaken the Pact for Mexico. Powerful PAN backbenchers have attacked party chairman Gustavo Madero for agreeing to the accord, saying it has made the conservatives too pliant to Pena Nieto's will. As pressure on him has mounted, Madero has trained his fire on the government, marking out a trail of alleged PRI corruption around Mexico on a giant map, and calling the pact into doubt. Madero's insistence that the PRI cannot be trusted may make it hard for him to back down if results do not go his way. Should the PAN go empty-handed and take out its frustration on the pact, Pena Nieto's hopes for cross-party consensus on Pemex and how to strengthen Mexico's weak tax take will suffer. "What does Enrique Pena Nieto's government gain from a PRI victory in Baja California? Very little. And it could lose a lot," said Jorge Buendia, head of polling firm Buendia & Laredo. Outwardly, the PRI is talking up its chances of winning Baja California. But in private, several PRI lawmakers admitted that if the PAN holds the state, it could help steady the pact. Few independent voter surveys have been conducted on the outlook for the Baja California election, but one released on Friday gave the PAN and its allies an 8 point lead over the PRI. The PRD has less to lose in the elections, with fewer elected officials in most of the 14 states, barring Oaxaca. TOUGHER TIMES AHEAD Pena Nieto has won praise for his efforts to reform the economy since taking power seven months ago, but the reforms of taxes and Pemex, due to be presented to Congress by early September, promise to be his biggest legislative challenges. Re-energizing Pemex and improving the tax take are arguably the two most important planks of the government's aim to ramp up average economic growth to around six percent per annum from little over two percent since the start of the millennium. Pena Nieto wants to change the constitution so Pemex can form partnerships with other companies, and to open the door to production and exploration contracts with oil majors. Opening up Pemex to foreign capital is a touchy subject in Mexico, and the PRD has already said it sees no need for constitutional changes to improve national crude oil output, which has fallen by a quarter since 2004. Pemex has been a symbol of Mexican pride since the PRI nationalized the oil industry in 1938, and previous attempts to reform the company have foundered on populist opposition. Though PRD officials have said in private the party may be willing to discuss tweaks to the constitution, Pena Nieto looks increasingly likely to depend on the PAN for a constitutional reform that would require a two-thirds majority in Congress. If Pena Nieto does pursue a shake-up of Pemex without the PRD, he is sure to face major street protests mobilized by the left - a prospect that has made the ruling party nervous. Speaking on condition of anonymity, one senior PRI lawmaker said Mexico risks inviting the kind of demonstrations that have rocked Brazil and Turkey in recent weeks if it ignores the PRD. Some 65 percent of Mexicans are opposed to foreign investment in Pemex, a survey last month showed. Still, parts of the oil industry already benefit from foreign investment. Dropping the PRD would also suggest that the Pact for Mexico was reaching the end of its natural lifespan. That would not mean the PAN, which has been pushing for a major overhaul of Pemex for years, would stop supporting economic reforms it believed in, said PAN senator Laura Rojas. But it would bring the government off the ambitious timetable the pact had laid out for its plans. Both the energy and fiscal reforms were scheduled to be passed this year. "If the pact does break ... it's going to cost the government a lot more work to pass its reforms," Rojas said.