The House took its first step to avert a government shutdown as President Obama began a series of rare meetings with Republican lawmakers on Wednesday, reviving chances for a long-term deal to reduce the federal deficit.

In hopes of avoiding a crisis this month, the House approved a six-month spending bill that would fund the government through the end of the fiscal year. The measure passed 267 to 151, with most Republicans supporting it and most Democrats voting against it.

The stopgap measure would provide $982 billion, enough to keep federal agencies humming past March 27, when current funding will expire. It also would lock in the across-the-board spending cuts known as the sequester for the rest of the fiscal year.

The bill will now head to the Senate, where Democrats are likely to seek amendments that would help blunt the effects of domestic spending cuts that began last week. But there is bipartisan optimism that a final version of the measure will clear Congress by the end of the month.

With a government shutdown now unlikely, Obama is focusing on a new round of talks that the White House hopes could break the fiscal impasse. After more than two years of negotiations with GOP leaders that did not achieve a “grand bargain,” the president is courting rank-and-file Republicans who may be interested in a deal that pairs cuts in entitlement programs with a tax overhaul that would include new revenue.

Obama invited 12 GOP senators to dinner Wednesday at the Jefferson Hotel in downtown Washington, where they dined for two hours. Obama picked up the tab personally, and two of his guests, Sens. John McCain (Ariz.) and Tom Coburn (Okla.), emerged flashing a thumbs-up.

“I think what he is really trying to do is just start a discussion and break the ice, and that was appreciated,” Mike Johanns (Neb.) told reporters as he left the dinner. “His goal is ours — we want to stop careening from crisis to crisis and solving every problem by meeting a crisis deadline.”

Next week, Obama will make a rare visit to Capitol Hill to meet separately with the Democratic and Republican caucuses in the House and the Senate.

There appears to be a growing desire among leaders at both ends of Pennsylvania Avenue to reach an accord that has eluded them. At the dinner, Obama and the Republicans spoke about the opportunity to work together through the budget and debt ceiling debates over the next four to five months, according to attendees.

“That was really the key -- how do we bring people together in a bipartisan way to get it done?” Sen. John Hoeven (R-N.D.) said. “And I think this kind of dialogue is what we need more of to get there.”

Obama’s new charm offensive marks a departure from his more combative recent negotiating style. Since winning reelection in November, he has pursued an outside strategy of rallying the public to ratchet up pressure on lawmakers to back his proposals.

Now, however, with the sequester cuts taking hold, White House aides said Obama sees an opportunity for productive discussions with Republicans about how to replace the sequester with a more thoughtful and less painful deficit-reduction plan.

Aides say Obama accepts that the sequester cuts are here, for now at least. But he wants to replace them quickly with a deal that includes overhauling entitlement programs such as Medicare and Social Security in exchange for raising $600 billion in new revenue by rewriting the tax code.

Entitlements were shielded from the sequester, which was designed to hit year after year for the next decade and total $1.2 trillion in cuts. As it continues, domestic and military programs will be hit hardest.

White House aides said they are encouraged by recent comments from Sen. Lindsey O. Graham (S.C.) and other Republicans that they are willing to consider a grand bargain that includes tax increases, although GOP leaders have resisted any new tax revenue.

The first step toward a broader discussion was ensuring that no major showdown occurs this month over keeping the government operating.

The measure the House passed Wednesday would provide new flexibility to the Pentagon to manage the sequester’s deep spending cuts but would otherwise leave the reductions in place for the year.

House Democrats pushed to be allowed to vote on an alternative that would replace the sequester with a mixture of higher taxes and different spending cuts.

To register their unhappiness about allowing the sequester to remain in place, 137 Democrats voted against the bill, sponsored by GOP leaders. Fifty-three Democrats joined 214 Republicans in voting for it. Fourteen members did not vote.

“This has an impact right at the kitchen table for the American people,” said House Minority Leader Nancy Pelosi (D-Calif.), who voted no.

Next, the House and the Senate will put forward competing — and probably starkly different — budget plans that will lay out tax and spending priorities for years to come.

Obama’s new outreach is a strategy for avoiding another crisis in the summer, when the nation will again bump up against a federal borrowing limit. Instead of initiating negotiations with House Speaker John A. Boehner (Ohio), the president is sidestepping GOP leaders and approaching Republicans one by one.

Obama’s dinner Wednesday included Sens. Kelly Ayotte (N.H.), Ronald H. Johnson (Wis.), Patrick J. Toomey (Pa.), Bob Corker (Tenn.), Daniel Coats (Ind.), Richard Burr (N.C.) and Saxby Chambliss (Ga.), as well as McCain, Coburn, Johanns, Hoeven and Graham.

The president has placed calls in recent days to other GOP lawmakers, including Sens. Rob Portman (Ohio) and Susan Collins (Maine) and House Budget Committee Chairman Paul Ryan (Wis.).

For years, lawmakers in both parties have complained that Obama was too insular; he acknowledged in January that “personal relationships are important, and obviously I can always do a better job.”

Former Senate majority leader Thomas A. Daschle (S.D.), a Democrat close to Obama, said: “There is no substitute for personal engagement. It creates avenues of communication that lead to opportunities for cooperation. And when that happens, one builds trust and deals get done.”

Johnson, who was elected in 2010 on a tea party wave, said Wednesday’s dinner would be his first chance to have an extended conversation with the president.

Other Republicans sounded almost giddy at the prospect of dining with Obama. McCain, one of Obama’s harshest critics, joked that he had made arrangements to trek through the snow that had been expected.

“I have a dog sled ready to go,” he told reporters.

Said Coburn: “If they’ll feed me, I’m looking forward to it.”

Collins lamented that was not invited. “It must have been something I said in the conversation with the president,” she joked, referring to her recent call.

But she noted that she had selected the menu for Obama’s lunch next week with all Senate Republicans: Maine lobster, Aroostook County potato chips and blueberry pie.

Nia-Malika Henderson, Ed O’Keefe and Karen Tumulty contributed to this report.

Discuss this topic and other political issues in the politics discussion forums.