CHICAGO — Illinois lawmakers overrode a veto of the Republican governor on Thursday, giving the state its first full budget in more than two years and ending the longest such impasse for any state in modern history.

The decision to approve the budget, which includes an income tax increase expected to generate about $5 billion, came as Illinois was sinking deeper into fiscal misery. The state is $15 billion behind in paying its bills; has delayed or stopped payments that have especially affected the elderly, poor and students; and has been warned that its credit rating could sink to junk status, the lowest for any state.

After continuing to battle over the budget as the state entered a third fiscal year without one this week, members of the Illinois House, which is dominated by Democrats, had exactly the 71 votes required to reject the veto of a tax increase by Bruce Rauner, a Republican who took office two years ago pledging to “shake up Springfield” and solve the state’s fiscal and political tangle. The State Senate voted to override the veto this week.

In Thursday’s votes on the budget package, at least 10 Republicans were among those who abandoned Mr. Rauner, who had argued that any tax increase had to be accompanied by other changes to state government, including a freeze on property taxes and cuts to workers’ compensation.

Uncertain, still, is how much the new budget will solve Illinois’s fiscal woes. Susana A. Mendoza, the state’s comptroller and a Democrat, said passage of the budget would immediately help the situation, which she had warned would grow even more dire, cutting into core services, in a matter of weeks had the override failed.

But Illinois still has one of the largest underfunded pension systems in the nation, and at least one credit ratings agency, Moody’s Investors Service, has warned that even with a budget, Illinois could face another rating downgrade, given a lack of “broad bipartisan support” and the unsolved pension problems.

“It will allow us to stop the hemorrhaging,” Ms. Mendoza said of the budget. “The last two years have taken us almost entirely off the cliff. But we’re by no means out of the woods. Our office is still going to be very challenged to pay the bills.”

The vote was delayed when the state Capitol building was placed on lockdown after a woman threw an unidentified white powder at the governor’s offices. A person was arrested.