Congress gave final approval for a massive, long-term farm bill, ending a bitter two-year partisan debate over funding for agriculture subsidies, crop insurance and the food stamp program.

The measure, which the Senate passed Tuesday by a vote of 68-32, will cost about $100 billion a year over five years — a savings of about $2.3 billion a year from current spending.

The five-year plan, which the House easily passed last week, is now headed to President Obama for his signature. The president supports the bill.

"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," he said shortly after the Senate vote.

The biggest sticking point was how much funding to cut from the Supplemental Nutrition Assistance Program, commonly called the food stamp program, which traditionally is included in the farm bill.

The final compromise will cut food stamp funding annually by about $800 million, or about 1 percent. That's twice the $400 million in cuts included in a bill that passed the Democratic-run Senate last year but a fraction of the 5 percent cut to the $80 billion program that House Republicans proposed last year.

The measure ends a $5 billion-a-year farm subsidy called direct payments, which are now paid to farmers whether they farm or not.

The bill continues to heavily subsidize major crops such as corn, soybeans, wheat, rice and cotton but would shift many of those subsidies toward crop insurance programs. This means farmers would have to incur losses before they received a payout.

The bill also leaves in place the federal sugar program, a collection of subsidies, tariff restrictions and production quotas that many fiscal conservatives and free-market advocates long have derided as outdated.

New elements in the bill include an expanded crop insurance program that will include organic farmers, more money for the development of biofuels and expanded funding for farmers markets.

More than 100 programs were eliminated, including the direct subsidies.

"Many people said this would never happen in this environment, but Congress has come together to pass a major bipartisan jobs bill," said Sen. Debbie Stabenow, D-Mich., chairwoman of the Senate Committee on Agriculture, Nutrition and Forestry Committee.

"This is not your father’s farm bill. It’s a new direction for American agriculture policy."

But Sen. Dean Heller, R-Nev., voted against the bill, saying it "props up a system of corporate welfare and runaway spending that is simply not sustainable."

Examiner Chief Congressional Correspondent Susan Ferrechio contributed to this report.