Updated

House Republicans sweated out a victory on a major budget cut bill in the wee hours Friday, salvaging a major pillar of their agenda despite divisions within the party and nervousness among moderates that the vote could cost them in next year's elections.

The bill, passed 217-215 after a 25-minute-long roll call, makes modest but politically painful cuts across an array of programs for the poor, students and farmers.

The victory on the deficit-control bill came hours after an embarrassing and rare defeat on a $602 billion spending bill for education, health care and job training programs this year. The earlier 224-209 vote halted what had been a steady drive to complete annual appropriations bills freezing many agency budgets.

• Click here to see how your representative voted.

The broader budget bill would slice almost $50 billion from the deficit by the end of the decade by curbing rapidly growing benefit programs such as Medicaid, food stamps and student loan subsidies. Republicans said reining in such programs whose costs spiral upward each year automatically s the first step to restoring fiscal discipline.

"This unchecked spending is growing faster than our economy, faster than inflation, and far beyond our means to sustain it," said Budget Committee Chairman Jim Nussle, R-Iowa.

Both bills are part of a campaign by Republican leaders to burnish their party's budget-cutting credentials as they try to reduce a deficit swelled by spending on the Iraq war and Hurricane Katrina.

The budget plan squeaked through after an all-day search by Speaker Dennis Hastert, R-Ill., and Acting Majority Leader Roy Blunt, R-Mo., to round up votes from reluctant moderates and other lawmakers uneasy with the bill.

House leaders now face arduous talks with the Senate, which passed a much more modest plan earlier this month. Negotiators face difficult negotiations over Arctic drilling, Medicaid and student loans, among other issues

To win House approval, Hastert ordered modest concessions on plans to limit eligibility for food stamps and require the poorest Medicaid patients to pay more for their care. He ordered killed a provision to deny free school lunches to about 40,000 children whose parents would lose their food stamps.

Those changes and other promises won the votes of lawmakers who had earlier registered opposition to the bill, including James Walsh, R-N.Y., Vernon Ehlers, R-Mich., and Sherwood Boehlert, R-N.Y.

The biggest concession came Thursday evening when Walsh won language permitting food stamp recipients making the transition to work to continue to be able to receive non-cash benefits for child care, transportation and housing without losing their nutrition benefits.

An earlier 224-209 vote against a $602 billion spending bill for health, education and labor programs disrupted plans by the Republican leaders to complete work on freezing many agency budgets through next September.

The afternoon vote was the first time in 10 years the House has rejected a final House-Senate compromise on a spending bill and the episode exposed weaknesses in the GOP leadership team after former Majority Leader Tom DeLay, R-Texas, was forced to step down from his leadership post after his indictment on money laundering and conspiracy charges.

Democrats were unanimous in opposing the one-year appropriations bill.

The companion deficit-reduction bill also drew unanimous opposition from Democrats, who objected to both cuts in programs for the poor and the fact that the deficit-reduction bill would increase the deficit when combined with a tax slated for a vote later that would extend tax cuts on capital gains and dividend income due to expire at the end of 2008.

"Name just one religion in the world that preaches the value of asking the most of those who have the least and asking nothing of those who have the most," said Chet Edwards, D-Texas. "Sadly, that is what this budget does."

Republicans who voted "no" included Jim Ramstad of Minnesota, Tim Johnson of Illinois and Nancy Johnson, Christopher Shays and Rob Simmons of Connecticut.

That overall bill would cut the deficit through a combination of new revenues from auctioning television airwaves to wireless companies and myriad cuts to entitlement programs like Medicaid.

The earlier concession to moderates involved leaving co-payments for the poorest Medicaid beneficiaries at $3 instead of raising them to $5. A provision denying Medicaid nursing home benefits to people with home equity of $500,000 was modified by raising the cap to $750,000.

Those changes came on top of concessions last week when Republican leaders, to appease moderates in their party, dropped provisions to open an Alaskan wildlife refuge to oil drilling and to allow states to lift a moratorium on oil drilling off the Atlantic and Pacific coasts.

Despite the changes, the core of the five year, $50 billion deficit-reduction bill remains intact. The most recent changes only chipped away at more than $800 million in cuts realized through cutting 300,000 working families from the food stamp program.

On Medicaid, the bill would generate almost $12 billion in savings through new cost-sharing burdens on beneficiaries and by letting states scale back coverage. It also would tighten rules designed to limit the ability of elderly people to shed assets to qualify for nursing home care. The bill also reduces pharmacy profit margins and encourage pharmacies to issue generic drugs.

On student loans, provision to increase interest rates and fees paid by student and parent borrowers would contribute to $14.3 billion in savings.

The deficit-reduction bill is the first effort in eight years to take on the automatic growth of mandatory programs like Medicaid, which make up about 55 percent of the budget. By comparison, the annual appropriations bills fund about one-third of the budget.