An unusual alliance of consumer advocates and industry groups won a victory this month when they helped persuade Congress to boost funding for the Food and Drug Administration, while most other programs paid for by a newly passed agriculture spending bill had their money slashed.

That alliance engaged in an old-style shoe leather campaign to prevent spending cuts for the FDA as the agency prepares to carry out a landmark food safety bill that was adopted by the previous Congress. The effort included at least four dozen visits to congressional offices and grass-roots events in the districts of key lawmakers involved in spending decisions, as well as advertisements in Capitol Hill newspapers.

This month, after weeks of haggling, Congress increased the agency’s funding by nearly 3 percent from last year’s level to $3.8 billion. Of all the additional money FDA secured, the new food safety program captured the largest amount: $39 million.

“Having consumers who were directly affected by food-borne illnesses standing shoulder to shoulder with the food industry sent a powerful message,” said Erik Olson, director of food programs at the Pew Health Group. “It’s not every day that a member of Congress sees somebody from a large food company come in with a consumer group to ask for more resources.”

Just as unusual is that industry, which has often battled against increased government oversight of its businesses, is chasing after any money at all for the agency.

“At a time when some industries are trying to handcuff their regulators, the food industry is advocating for a stronger regulator with more powers and more resources,” said Scott Faber, a vice president at the Grocery Manufacturers Association.

GMA, the American Frozen Food Institute, the Snack Food Association and the Produce Marketing Association were among many groups that made their case in an advertisement sponsored by the Alliance for a Stronger FDA. The ad said that “a science-based and predictable FDA” helps industry to innovate and create high-paying jobs. The products regulated by FDA account for more than 20 percent of U.S. consumer spending.

There are plenty of other dollars-and-cents reasons for industry to support a stronger FDA, experts who track the industry said. Major recalls linked to food-borne illnesses exact real and reputational costs by shaking consumer confidence.

Demand for spinach took years to recover after the 2006 E. Coli outbreak, with total retail expenditures on bagged spinach dropping about $202 million in the 68 weeks after the recall, according to federal data. Kellogg said that it cost roughly $70 million for it to recall some of its peanut-containing products in the wake of a deadly salmonella outbreak linked to one of its suppliers, a peanut processing plant in Georgia. More recently, a listeria outbreak tied to cantaloupe from one Colorado farm destabilized the entire melon industry.

“I mean God forbid to have another recall like this. . . . It just froze the market,” Mohammad Abu-Ghazaleh, chief executive of Fresh Del Monte Produce, said this month in a call with analysts after his company released its quarterly earnings.

Such high-profile recalls can also have a chilling effect on U.S. food exports. The United States exports more food than it imports in part because a growing middle class in emerging markets such as India has boosted demand for U.S. products, Faber said. Having foreign consumers trust U.S. foods is key.

“We’re competing with manufacturers all over the world,” Faber said. “Maintaining and burnishing FDA’s reputation helps us open doors in those markets.”

The illnesses and recalls of the last decadedamaged that reputation. In response, Congress adopted the Food Safety Modernization Act late last year — the first major change in food safety laws since 1938.

That law empowers the FDA to prevent food-borne illnesses instead of simply reacting to them. To that end, the legislation would require companies to adopt internationally recognized strategies that would help them spot and consistently test for potential food hazards. It would dramatically increase inspections at food processing plants and farms as well as grant the agency access to companies’ internal records — all of which will require hundreds of new FDA hires.

“You need to put controls in place, validate their effectiveness and monitor that they’re actually working over time,” said Mike Taylor, the FDA’s deputy commissioner for foods. “That’s a system that’s evolved in the food industry but has been adopted piecemeal.”

The law also requires that food imported into this country must meet the same safety standards as food produced domestically, another reason that the U.S. industry pushed hard for FDA funding. About 15 percent of the nation’s food is imported, including nearly two-thirds of fruits and vegetables and 80 percent of seafood, according to the FDA.

“A lot of the motivation for this reform is creating a level playing field,” Taylor said.

Yet, after the legislation was enacted late last year, its funding remained uncertain.

In June, House Republicans cut millions from the FDA’s budget, citing the need to lower the national deficit. Axing the money prompted industry and consumer advocates to redouble their lobbying efforts on behalf of funding the new food safety law.

Ultimately, the cuts were rejected when Senate and House lawmakers met to negotiate differences between their respective agriculture bills, which also determined the funds for USDA and rural development. The FDA got the single largest increase in discretionary spending. Its programs were among only a half dozen that got a year-over-year funding boost.

Researchers Lucy Shackelford and Julie Tate contributed to this report.