WASHINGTON – Congress arrived at an agreement Wednesday after weeks of wrangling to reopen the federal government and raise the nation’s debt ceiling that left a bitter taste in the mouths of conservatives.

Senate Democratic Leader Harry Reid, of Nevada, and Senate Republican Leader Mitch McConnell, of Kentucky, announced that a bipartisan deal had finally been reached shortly after noon – a day before the government’s borrowing capacity was expected to expire, raising the prospects of default.

The sides agreed to a temporary spending bill that will keep the government open through Jan. 15 and permit the Treasury to borrow the funds necessary to pay the nation’s bills through Feb. 7. It also sets the stage for bicameral negotiations over federal spending and taxation.

It passed the Senate easily, 81-18. The “no” votes came from Sens. Tom Coburn (R-Okla.), John Cornyn (R-Texas), Mike Crapo (R-Idaho), Ted Cruz (R-Texas), Mike Enzi (R-Wyo.), Chuck Grassley (R-Iowa), Dean Heller (R-Nev.), Ron Johnson (R-Wis.), Mike Lee (R-Utah), Rand Paul (R-Ky.), Jim Risch (R-Idaho), Pat Roberts (R-Kansas), Marco Rubio (R-Fla.), Tim Scott (R-S.C.), Jeff Sessions (R-Ala.), Richard Shelby (R-Ala.), Pat Toomey (R-Pa.), and David Vitter (R-La.).

The bill then went over to the House, where it passed 285-144 with the support of all 198 Democrats voting and 87 Republicans. The “no” votes stood at 144 GOPs, including House Budget Committee Paul Ryan (R-Wis.), who broke with the rest of leadership.

A surprising “aye” vote came from Rep. Tom Cotton (R-Ark.), one of the conservatives who met with Cruz in the basement of a Capitol Hill Mexican restaurant Monday night. Cotton is trying to unseat Sen. Mark Pryor (D-Ark.) next year.

The House adjourned until Monday.

The original reason for the contretemps – the desire of Tea Party conservatives in the House and Senate to either defund or delay implementation of the Affordable Care Act – better known as Obamacare – is barely mentioned in the deal. The only provision dealing with the healthcare reform law requires families seeking federal subsidies to purchase health insurance to prove they qualify for the benefit.

The bill legislation also provides that federal workers who have been furloughed for more than two weeks will receive back pay.

Ultimately, the final agreement resembles a settlement the two sides could have reached more than two weeks ago – before the government partially shut down on Oct. 1 for lack of spending authority.

McConnell, who stepped in when the House failed to develop a compromise acceptable to both parties, acknowledged that the result was “far less than many of us hoped for,’’ but expressed satisfaction that budget cuts implemented as a result of the Budget Control Act of 2011, familiarly known as sequestration, remain intact.

“This has been a long challenging few weeks for Congress and for the country,’’ McConnell said. “It’s my hope that today we can put some of the most urgent issues behind us.’’

Reid said the compromise “will provide our economy with the stability it desperately needs.’’

“After weeks spent facing off across a partisan divide that often seemed too wide to cross, our country came to the brink of a disaster,’’ Reid said. “But in the end, political adversaries set aside their differences and disagreements to prevent that disaster.’’

The measure carried the full support of the White House.

“The president believes that the bipartisan agreement announced by the leaders of the United States Senate will reopen the government and remove the threat of economic brinksmanship that has already harmed middle-class families, American businesses and our country’s economic standing in the world,” White House Press Secretary Jay Carney said.

Obama credited Reid and McConnell for acting swiftly “to end this shutdown and protect the full faith and credit of the United States of America.”

But some lawmakers who took a hard line on federal spending and sought to kill Obamacare expressed disgust with the final product. Cruz, who led the fight against the Affordable Care Act and attempted to tie the Senate in knots to force Democrats to accept some changes, said that “Washington’s indifference to the plight of the American people has never been more apparent’’ as a result of the agreement.

“Countless Americans all over the nation are being notified their premiums are skyrocketing,’’ Cruz said. “Others are losing jobs or seeing their work hours reduced, and thousands upon thousands are losing their healthcare plans altogether. All because of Obamacare.’’

Under Obamacare, every American is required to purchase health insurance, with those financially unable to do so receiving federal assistance. They will be able to purchase coverage through what is known as the Health Insurance Marketplace. In a year, large companies will be required to provide full-time employees with coverage.

Cruz said he had a single standard for supporting a deal – “Does it provide meaningful relief for the millions of Americans who are being harmed by Obamacare?’’

“The answer is no,’’ he said, adding that Congress has “decided to ignore their pain and suffering.’’

Rubio, another lawmaker with ties to the conservative Tea Party movement, likewise said he would oppose the compromise because it fails to get federal spending under control.

“I cannot support this deal because it postpones any significant action on pro-growth and spending reforms and does nothing to provide working class Americans even one shred of relief from ObamaCare’s harmful effects,’’ he said. “Until we tackle the real threats to the American Dream, we are going to continue finding ourselves in these kinds of messes.  America is better than this, and the American people deserve better.”

Feelings were particularly raw on the House side where Republicans spearheaded the effort to draw concessions from President Obama and Senate Democrats.

Obama drew a line early in the debate, insisting that he would not negotiate terms while the government was closed and would not engage in talks in any instance over the debt ceiling, arguing that the full faith and credit of the U.S. Treasury was at stake if the nation crossed over the debt ceiling and couldn’t keep its commitment.

The lower chamber, led by House Speaker John Boehner (R-Ohio), ignored White House warnings and moved ahead in demanding concessions, first insisting that Obamacare be defunded, then shifting ground to delay its implementation for a year. When those requests went unmet, and the federal government was forced to close its doors and the debt ceiling deadline loomed, the GOP leadership navigated yet another course, this one seeking additional spending cuts.

But Obama and Reid remained unmoved, backed by polling that showed the public, by a significant margin, blaming Republicans for the ongoing imbroglio. Finally, with the government bumping up against the debt ceiling, McConnell and Reid stepped in to negotiate a solution. Even that was delayed when the House, at Boehner’s insistence, attempted to take one more stab at an agreement – which failed once again.

Throughout the debate, Boehner sought a resolution that could pass with the support of House Republicans, a divided group with Tea Party lawmakers holding greater sway than their numbers would indicate, and Senate Democrats. That effort failed.

Boehner met with the House Republican caucus Wednesday afternoon and made it clear he would permit the Senate compromise to come to the floor for a vote – something he avoided doing with previous upper chamber efforts to reopen the government and raise the debt ceiling. He further urged lawmakers to support the compromise.

“The House has fought with everything it has to convince the president of the United States to engage in bipartisan negotiations aimed at addressing our country’s debt and providing fairness for the American people under ObamaCare,’’ Boehner said. “That fight will continue.  But blocking the bipartisan agreement reached today by the members of the Senate will not be a tactic for us.  In addition to the risk of default, doing so would open the door for the Democratic majority in Washington to raise taxes again on the American people and undo the spending caps in the 2011 Budget Control Act without replacing them with better spending cuts.’’

Boehner said the effort to “stop the train wreck that is the president’s healthcare law’’ will continue.

“We will rely on aggressive oversight that highlights the law’s massive flaws and smart, targeted strikes that split the legislative coalition the president has relied upon to force his health care law on the American people,’’ Boehner said.

Reid noted that the legislation instructs House and Senate leaders to appoint conferees to a budget conference committee, an initiative that thus far has eluded the grasp of the 113th Congress. It was agreed to, Reid said, “in order to assure Congress continues the work of setting this country on a path to fiscal sustainability.’’

The conference, Reid said, “is the appropriate place to discuss our differing views of the best way to chart a course for economic growth.”