WASHINGTON—The Senate approved a five-year farm bill Tuesday, ending a nearly three-year slog in Congress to overhaul agriculture support programs and food-stamp funding.

The 68-32 Senate vote capped a hard-fought battle to pass the first comprehensive farm policy package since 2008, shifting how Washington provides agriculture support and making relatively modest changes to nutrition programs.

It now goes to the White House for President Barack Obama's expected signature.

Conservatives eager to reduce the federal budget deficit opposed the behemoth bill—which clocked in at 949 pages and $956 billion in spending over 10 years—adding a new political hurdle to the perennial regional tensions that bedevil every major farm measure.

"I have never seen such a roller coaster in my life," said Sen. Patrick Leahy (D., Vt.), citing nearly 40 years on the Senate Agriculture Committee. "I have never seen such a difficult and complex effort."