WASHINGTON — Republican and Democratic leaders in Congress announced a deal Tuesday to keep funding the US government through next March, avoiding a potential partisan shutdown fight ahead of November's election.

Harry Reid, the Senate's Democratic majority leader, said the deal on the so-called continuing resolution (CR) was reached between himself, Republican Speaker of the House John Boehner, and President Barack Obama, and will allow operations to continue through the first quarter of 2013.

"It will provide stability for the coming months," Reid told reporters.

"This is very good," he added. "It puts this out of the way."

Reid said it was not possible to draft the document and vote on it by the time Congress goes on its August recess on Friday, "but we've got an agreement, we'll vote on it when we get back in September."

That's crucial because the current fiscal year ends on September 30, and Congress would be in session for barely three weeks between now and then, with most congressional attention focused on the election.

Reid said the deal was forged in a "spirit of compromise," a rare feat these days on Capitol Hill where partisan bickering has become the norm among lawmakers.

Boehner acknowledged the deal as well, saying in a statement that "committee members and their staff will write legislation that can be passed by the House and Senate in September and sent to President Obama to be signed into law."

The deal heads off what could have been an explosive showdown over the budget in the run-up to the November 6 election that will see Republican Mitt Romney challenge President Barack Obama for the White House.

If Congress passes the resolution, the funding would be consistent with the $1.047 trillion level agreed to in the 2011 Budget Control Act, above the $1.028 trillion which Republicans called for in House Budget Committee chairman Paul Ryan's proposal earlier this year.

The deal would remove one of the key elements of unfinished congressional business that make up the "fiscal cliff," which includes decisions on whether to extend the Bush-era tax cuts and how to avoid some $109 billion in domestic and military spending cuts set to kick in early next year if Congress does not act.

Some Republicans pushed for a six-month resolution because, should their party win back the White House and Senate and hold the House in November, they would be better positioned to pass a more conservative budget in 2013.

A three-month CR, they warned, would have set the stage for budget negotiations during the lame-duck session of Congress, when defeated lawmakers and a potentially defeated Obama could have sought to ram through increased spending on their way out of office.