The Senate voted 59 to 39 Wednesday to restore emergency jobless benefits to millions of people who have been out of work for more than six months.

House leaders said they will ratify the measure Thursday and send it on to the White House, where President Obama plans to immediately sign it.

The bill would authorize states to provide retroactive support to an estimated 2.5 million people whose unemployment checks have been cut off since federal benefits expired June 2. It would also make available up to 99 weeks of income support through the end of November to millions more who have exhausted state benefits, which typically last for 26 weeks. Advocates for the unemployed say it could be several weeks in some states before the checks are in the mail.

The vote comes after a months-long battle over whether to pay for the $34 billion measure or add that sum to the nation’s mounting national debt. Both parties have agreed in the past not to pay for emergency jobless benefits during periods of high unemployment, in part because cutting spending or raising taxes to cover the cost could depress economic activity.

The measure now goes to the House, which has already approved an extension of jobless benefits but must vote again for procedural reasons.

But the recent recession, coupled with public spending to revive the economy, has pushed government debt loads here and abroad into dangerous territory, sparking a crisis in Europe and heightening public anxiety in the United States.

Republicans have been playing to those fears in hopes of regaining control of Congress in this fall’s midterm elections. With unemployment at 9.5 percent, they agreed that jobless benefits should be extended but said the cost should be covered with unexpended funds from last year’s economic stimulus package.

Democrats have accused the GOP of playing politics with the lives of millions of unemployed workers, noting that Republicans want to extend tax cuts for high-earners that would add nearly 20 times as much to the nation’s debt over the next decade.