By Hilary Russ

(Reuters) - Pennsylvania lawmakers on Wednesday passed a revenue plan for fiscal 2017 that Governor Tom Wolf said he will sign, a late-coming agreement but one that still shows significant cooperation compared to last year's damaging nine-month political gridlock.

The Republican-led legislature had passed a $31.6 billion spending plan by the start of the new fiscal year on July 1, but not a corresponding revenue plan.

"Today's passage of a revenue package means that we avoid another lengthy impasse, our budget is balanced this year, and we have greatly reduced the commonwealth's structural budget deficit," Wolf, a Democrat, said in a statement, adding that he will sign the bill.

New revenues will come from several sources, including higher taxes on tobacco products and online downloads of books, music and movies.

The finalized budget could also eliminate the threat of an immediate credit downgrade.

S&P Global Ratings warned on Monday that it could cut its AA-minus rating on the states' general obligation (GO) debt. But the rating agency said it would remove that threat if lawmakers crafted a balanced budget within 90 days.

The state plans to sell about $1.2 billion of new GO bonds next week.

Resolving the budget debate now could potentially lower the state's borrowing rate next week by settling a big uncertainty, which can lead investors to demand higher interest rates as compensation for greater risk.

Last year's budget was nine months overdue and forced school districts to borrow about $1 billion to stay open while their state aid sat in limbo.

(Reporting by Hilary Russ; Editing by Sandra Maler)