WASHINGTON – Overcoming months of gridlock, the Senate approved a small-business bill on Thursday that hands President Obama an election-year victory but shows just how difficult it has become for lawmakers to agree on the best way to help the sluggish economy and create jobs.

The measure passed by a 61-38 vote, with just two Republicans crossing party lines to support the bill, which would create a $30 billion small business lending fund and provide $12 billion in tax breaks to help companies invest and hire. The bill now heads to the House where it is expected to swiftly pass.

Yet a months-long impasse over the bill to aid small businesses, which have been hard hit during the economic downturn and are championed by both parties as engines of the recovery, highlights the partisan divisions before the fall midterm election.

“It tells you the depth of the gridlock and dysfunction that unfortunately has gripped the Congress,” said Sen. Evan Bayh, D-Ind.

The bill enjoyed bipartisan support at the outset, but the addition of the $30 billion small-business lending fund to give credit-starved firms access to capital created insurmountable partisan divisions.

Republicans quickly opposed the lending fund as a “mini-TARP” — reminding voters of the unpopular Troubled Assets Relief Program that was the cornerstone of the 2008 federal bank bailout.

Republicans filibustered in July, demanding the chance to offer more amendments, including those unrelated to the legislation. Democrats shelved the bill as the debate dragged on and other legislation took priority.

Those expected to champion the bill from the business community — the U.S. Chamber of Commerce and the National Federation of Independent Businesses — instead focused on using the legislation as a vehicle to overturn an onerous business reporting requirement in the new health care law.

“All of a sudden it became a partisan exercise again,” said Sen. Orrin Hatch, R-Utah. “It’s amazing to me how difficult it is to work together around here, even when we want to.”

Republican Sen. George LeMieux of Florida and Sen. George Voinovich of Ohio, neither of whom is seeking re-election, joined 57 Democrats and two independents to pass the measure.

The House passed a version of the bill earlier this year, and at one point over the summer, frustrated House lawmakers walked across the Capitol to stage a quiet sit-in at the Senate chamber to protest the delays on this and other jobs bills.

“While I am grateful for this progress, it should not have taken this long to pass this bill,” Obama said on the eve of Senate action. He has promised to quickly sign the legislation.

The bill offers $12 billion in tax breaks to businesses to encourage investment, entrepreneurship and hiring.