WASHINGTON—The House on Thursday narrowly passed a bill curtailing spending on food stamps, setting up a battle with the Senate, which backs far smaller cuts. The vote was 217-210.

The bill would cut nearly $40 billion over a decade, or about 5% in expected spending, from Supplemental Nutrition Assistance Programs.

Food Stamp Enrollment by State

The number of people receiving food stamps through the federal Supplemental Nutrition Assistance Program rose during the recession. The sluggish job market, higher poverty rate and changes to the way applicants are evaluated have contributed to the rising ranks.

The Senate has called for a cut of about $4 billion to the programs. About 48 million Americans received food-stamp benefits last year.

Passage of the bill paves the way for negotiators from the House and Senate to start hashing out a deal to extend nutrition programs and farm programs that expire at month's end.

The bill's passage marks a victory for House Republican leaders, who were forced to regroup after an attempt to cut funding more modestly for food-stamp programs failed earlier this summer when paired with the broader farm bill. The House later passed a stand-alone farm bill in July.

Senate Democrats have made clear they won't agree to cuts of the magnitude passed by the House.

"Not only does this House bill represent a shameful attempt to kick millions of families in need off of food assistance, it's also a monumental waste of time," Senate Agriculture Committee Chairwoman Debbie Stabenow (D., Mich.) said in a statement after Thursday's vote.

To craft the House bill, a working group led by House Majority Leader Eric Cantor (R., Va.) cobbled together support from conservative lawmakers who had balked at the smaller cut proposed in June and more centrist Republicans, reaching a deal after three meetings, according to House GOP aides.

About half of the bill's $39 billion in savings comes from a measure ending states' ability to waive a federal requirement that "able-bodied" people without dependents work at least 20 hours a week or be in job training in order to receive food stamps. Currently, states with a jobless rate above 10% can exempt some people.

"This is not about taking food away from anyone who needs help," said Rep. Marlin Stutzman, an Indiana Republican who was part of the House group that crafted the bill.

If the House and Senate cannot reach agreement, many nutrition programs would likely continue at current spending levels under other bills aimed at keeping federal agencies funded into the new fiscal year, which starts on Oct. 1. The two chambers are working on a short-term measure that would fund agencies through mid-December at current levels, giving lawmakers time to negotiate spending levels for the remainder of the year.

Write to Kristina Peterson at kristina.peterson@dowjones.com