A Mexican newspaper magnate and a Houston financier pooled forces and yesterday won the battle to buy financially strapped United Press International for a price that could exceed $40 million.

Mario Vazquez Rana and Joe E. Russo appeared at a news conference last night after winning support for their joint bid from UPI management, the wire service's union and a committee of its creditors. The two men pledged to continue the company's basic wire-service operations and to guarantee its editorial integrity, although they also said they plan to expand UPI's purview in as yet undetermined ways.

Vazquez will be the chief operating partner for the new company, the two men said.

The plan is subject to the approval of a federal bankruptcy judge, but approval isn't expected to be a major stumbling block, because the plan is supported by the major parties involved in the negotiations over UPI's future.

Yesterday's agreement capped weeks of intensive negotiations to find a buyer for the 78-year-old news agency, which has been in dire financial straits for several years and which filed for protection under Chapter 11 of the federal bankruptcy code in April. More than two dozen groups reportedly had made offers to buy the agency.

Although the negotiations were reported to be drawing to a close this past weekend, the final proposal apparently did not materialize until yesterday, when Vazquez and Russo, two of three finalists in the bidding, said they began discussing pooling their proposals. The other finalist was a consortium headed by Financial News Network, a cable-television company.

Under the agreement reached with UPI management, the union and the creditors' committee, Vazquez and Russo agreed to pay $25 million to creditors and to invest between $15 million and $30 million for working capital, according to Jeffrey Peterson, a Wall Street investment banker who advised UPI on the sale. Officials said that the exact proportion of costs shared by the two executives has not yet been determined, but Vazquez, who was described as heading up the coalition, will become the principal owner.

The new owners also reached an agreement with the Wire Service Guild, which represents about 750 UPI employes, on key labor measures, including provisions for profit-sharing in the new company, two seats on the board of directors and a guarantee that UPI will remain based in the United States. Guild President William Morrissey also said Vazquez has agreed to bring wages for UPI employes in line with those of The Associated Press, which has a higher scale, over the next five years.

Last night's dramatic announcement signaled an unlikely marriage between two businessmen with vastly different histories. But a source familiar with the negotiations said the joint venture makes sense because each man's strengths complemented the other's perceived weakness. As a foreigner, Vazquez reportedly encountered opposition from some UPI executives who felt the company should stay in American hands. On the other hand, Russo has no background in journalism.

Vazquez, 53, is Mexico's largest newspaper publisher, owning 70 daily newspapers with a combined circulation of 2.1 million. He bought the Mexican Publishing Organization in 1976, when it was $78 million in debt, and turned it around, according to a UPI statement.

He also has played a major role in the international Olympic movement. He was captain of Mexico's marksmanship team in the 1972 summer games, and since 1979 has been president of the Association of National Olympic Committees, which makes recommendations about eligibility rules and other matters relating to the games, according to Bill Paul, a U.S. Olympic Committee official.

Vazquez also heads the Mexican Olympic Committee and is president of the Pan American Sporting Organization, which runs the Pan American games. Russo, also 53, has taken a markedly different route to wealth. He controls a real estate and financial services empire with assets estimated in excess of $1 billion, has been extremely active in Houston civic affairs and recently was appointed by the governor to the Texas Economic Development Commission.

Last night, both men expressed confidence that UPI's financial woes and other problems could be turned around, and pledged cooperation with current management and the union. Vazquez also pledged autonomy for UPI news decisions. Vazquez declined to elaborate on his plans, although Russo reportedly has expressed interest in expanding the agency into information-technology areas.

"I have had a great desire for three years to buy UPI, and it looks like today everything is going my way," Vazquez said.

Russo said, "I'm looking forward to the new UPI era. I've always been associated with winners."

UPI Chairman Luis Nogales said the offer tendered by the two men satisfied the major criteria considered by the agency in reaching its final decision about who to support. These included the finances needed to pay off creditors and provide working capital, and guarantees of editorial independence.

"Mr. Vazquez and Mr. Russo were two of the earliest parties to express interest in investing in UPI, and both have spent a great amount of time analyzing the company," he said. Their agreement to buy the company "guarantees UPI's future as a full-service and financially secure international news agency," he added.

Vazquez said it has not been determined what, if any, position Nogales would retain with UPI.