lection-year politics briefly delayed passage of legislation in the U.S. Senate to fund federal programs for six months and avoid an October 1 government shutdown, as lawmakers on Friday inched closer to a recess that would extend through the November 6 elections.

After days of bickering that threatened to spill into the weekend, Senate leaders reached a deal to allow a vote around midnight on the bill already passed by the House of Representatives to keep the government operating in the absence of a long-term funding measure.

The short-term money bill is now expected to clear the Senate by early Saturday morning and then be sent to President Barack Obama for his signature into law.

But first, Democratic and Republican Senate leaders had to clear some obstacles that were delaying the vote.

Both Democrats and Republicans used the "must-pass" $524 billion spending extension, called a continuing resolution, to push for votes on unrelated legislation that could help their political fortunes.

Republicans secured a vote on a bill sponsored by Senator Rand Paul that would cut U.S. aid to Pakistan, Egypt and Libya in response to violent attacks at U.S. installations in those countries.

The aid measure has little chance of becoming law, but allows some Republicans seeking re-election to claim that they are being tough on Obama's foreign policy.

Democrats secured a procedural vote on a hunting and fishing bill aimed at helping the campaign of Democratic Senator Jon Tester, who is in a tough re-election fight in Montana that threatens the thin Democratic majority in the Senate.

A stop-gap funding measure must be signed into law by Obama by September 30, the end of the fiscal year, or the government will have to start shutting down agencies and operations from national parks to some air traffic controllers.

The measure, which funds the government's discretionary expenditures until March 27 at the annualized rate of $1.047 trillion, was aimed at neutralizing the threat of another nasty government shutdown fight just weeks before the election.

The Republican-led House passed the continuing resolution last week by a substantial margin with little rancor and no major changes.