Congress gave final approval Tuesday to a sweeping overhaul of federal farm and nutrition policies, sending a five-year farm bill to President Obama for his signature.

The Senate voted 68 to 32 to approve the $956.4 billion agreement, which Obama is expected to sign in the coming days.

“As with any compromise, the Farm Bill isn’t perfect — but on the whole, it will make a positive difference not only for the rural economies that grow America’s food, but for our nation,” Obama said in a statement after the vote.

After almost four years of intense negotiations between Democrats and Republicans, the package was formally introduced and passed by Congress in one week.

Senate Agriculture Committee Chairman Debbie Stabenow (D-Mich.) described the agreement as “a major bipartisan jobs bill that makes sure that 16 million people who work in agriculture . . . have the support that they need.”

The 959-page bill ends billions of dollars in direct subsidy payments to the nation’s farmers. In their place, farmers can take advantage of a new crop insurance program. The agreement also saves billions by consolidating government conservation programs and cuts about $8 billion in funding for food stamps.

The bill is supposed to cut about $16 billion in spending during the next decade, according to the Congressional Budget Office. Supporters said the savings will be closer to $23 billion if automatic cuts to Agriculture Department programs that took affect last year are factored in.

Negotiations over a new bill nearly collapsed in July when House GOP leaders split the farm bill and had separate votes on measures setting most agricultural policy and another that would have slashed $40 billion in federal food stamp money by dramatically rewriting eligibility rules.

Ultimately, House and Senate negotiators agreed to cut about $8 billion – or 1 percent of the budget of the Supplemental Nutrition Assistance Program — by closing a loophole that several states and the District of Columbia have used to boost SNAP payments to low-income households. Supporters said the cuts will come by implementing safeguards designed to reduce waste, fraud and abuse in the program.

But several organizations who advocate for the nation’s poor strongly objected to the cuts in food stamps.

Marian Wright Edelman, head of the Children’s Defense Fund, called the cuts “indefensible.”

“There should be no hungry people — especially children — in rich America,” she said. “It is shameful that Congress continues to treat poor Americans like second class citizens by cutting supports they desperately need.”

In a notable break with Stabenow and party leaders, nine Democratic senators from Northeastern states with large urban areas voted against the final bill mostly because of the cuts in food stamps. Twenty-three Republican senators voted no, mostly because the bill didn’t more aggressively curtail overall government spending.