J. Dennis Hastert (R-Ill.) did not ask to be House speaker. He didn't even lobby for the job. But he didn't want to lose the job, either, and he had staked his credibility on a $792 billion tax cut. So as the vote approached, he was not too proud to beg for support.

"We've been friends for 20 years," Hastert reminded Rep. Ray LaHood (R-Ill.), a deficit hawk who used to serve with Hastert in the Illinois legislature. "My speakership is on the line. Our majority is on the line. Please, I need your vote."

Yesterday, LaHood voted with Hastert. So did most of the Republican moderates who had denounced the size of the tax cuts, after the speaker agreed to make some of the relief conditional on reducing the national debt. So did every one of the GOP conservatives who had demanded even more tax relief for married couples, after the speaker agreed to increase the original total. And Hastert escaped with the sweetest victory of his turbulent seven-month speakership, averting a humiliating defeat that would have renewed questions about his ability to lead.

But while Hastert's allies hailed yesterday's 223 to 208 vote as a vindication of his soft-edged, listen-first leadership style, it also was a stark indication of the problems that still lie ahead for the avuncular former wrestling coach. Hastert is trying to govern the House with a five-vote majority, so unless he can attract Democratic support, he will have to get his ideologically diverse caucus to march almost entirely in lockstep. If Hastert had to beg his friends to bail him out on tax cuts, the crown jewel of the GOP agenda, that task is unlikely to get any easier.

"It's tough. If five people wake up and don't want to do the same thing you do, nothing gets done," Hastert said. "This was a big day for us, but we'll have other challenges."

Hastert, a well-liked deputy whip who had served quietly in Congress since 1987, was a virtual unknown outside the Beltway when the speaker's gavel landed in his hand in January. But House Republicans were desperate for a conciliator to restore calm -- Newt Gingrich (R-Ga.) had been ousted after the November election, and the man who was to succeed him, Bob Livingston (R-La.), resigned suddenly. So Majority Whip Tom DeLay (R-Texas) rounded up the votes, and suddenly Hastert was in charge of the House.

It did not take long for questions to arise about his fitness for the job. Hastert was battered over his uncertain handling of several House votes on the Kosovo conflict, and at times this spring he seemed to lose control of the budget process. He also predicted that the House would pass a modest gun-control package, then watched it go down to defeat. The Capitol Hill buzz has been that Hastert is just a stooge, that DeLay is the real power behind the throne.

But last week, Hastert was very much in control, meeting with dozens of recalcitrant Republicans, usually one on one. He also pleaded for tax-cut unity at GOP caucuses Tuesday and Wednesday. He met with moderate holdouts Tuesday night. He lunched with conservative holdouts on Wednesday; they ate chicken barbecue, he stuck to cake and a cookie. On Wednesday evening, he appealed once again to moderates.

In the end, Hastert made some compromises to keep the caucus together. But the main reason the bill passed may have been simpler: Just about every Republican wants Hastert to succeed. After the bill crossed the 218-vote threshold it needed to pass yesterday, Rep. Christopher Shays (R-Conn.) led the GOP lawmakers in a rousing chant of "Coach! Coach! Coach!"

"I hope that now somebody will finally write that Denny Hastert is speaker of the House," DeLay said after the vote. "After today, you can't write anything different. This is Denny Hastert's bill."

Hastert began all of his meetings with lawmakers by listening, but then he used a variety of arguments to bring them around. He appealed to party loyalty, telling moderates that he had to keep conservatives in line, telling conservatives that he could not ignore moderates. He warned that defeating the bill would play into Democratic hands, making the GOP leadership look ridiculous. He reminded them that they had chosen him to serve as speaker, and implored them to support him again: "I am asking you to follow me." And when some of the holdouts refused to budge, he bluntly asked them: "What would it take for you to support this bill?"

Rep. David M. McIntosh (R-Ind.) led the half-dozen conservatives who had demanded more relief from the "marriage penalty." He said Hastert tried to get them to drop their opposition but never blamed them for raising the issue. In the end, he promised most of what they wanted.

"Newt would have said: `David, you're being stupid. We've already got this worked out. Don't rock the boat,' " McIntosh said. "With Denny, you're free to push your point. He expects you to join the team in the end, but nobody was getting their heads knocked in."

Earlier this week, it looked as though moderates were going to kill the bill, but Hastert brought them on board as well. He dispatched two of them, Stephen Horn (R-Calif.) and Nick Smith (R-Mich.), to craft language tying some of the tax relief to debt reduction. Then on Wednesday night, he kept calling moderates into his office. Every time one of them brought up debt reduction, he sent the lawmaker down the hall to Ways and Means Committee Chairman Bill Archer (R-Texas), who was conducting a seminar on the new language. Other lawmakers, including Marge Roukema (R-N.J.), were wooed with promises of a "colloquy," a parliamentary dance in which they can make their point in public through a brief chat on the House floor.

"That was essential," Roukema recalled yesterday. "I wanted them to state on the record that there was nothing that would jeopardize our commitment to Social Security or Medicare."

By 8 p.m. Wednesday, Hastert finally had the votes, and he took a break to sip wine on his balcony with old friends such as Reps. Porter J. Goss (R-Fla.) and Joel Hefley (R-Colo.) as a marching band played outside. Throughout the tense negotiations, aides and other lawmakers said, Hastert never lost his cool.

"Denny's view is we're just going to sit down, listen to people, figure out what we need to do and do it," said former Rep. Bill Paxon, who watched the parade of legislators through Hastert's office. "Of course, there's another contest next week. That's no surprise."

Next week, of course, Hastert might have to go through this all over again. He won the debate over tax cuts, but he also reminded his fractured caucus that even a handful of Republicans can win important concessions when they have the power to stall a bill. Some Republicans described yesterday's vote as a huge victory for Hastert, but he is still burdened with the smallest majority since the 1950s. Randy Tate, executive director of the Christian Coalition, compared Hastert's job to "pushing water uphill."

Said Rep. John Thune (R-S.D.), another conservative who had threatened to vote against the bill: "He's got all these factions out there, and any five of us can tube the deal. Every bill's going to be like this. Every vote is a war."

CAPTION: Speaker J. Dennis Hastert, whose leadership has been questioned, scored a major legislative victory.

CAPTION: House Speaker J. Dennis Hastert speaks to reporters in the Capitol, backed by tourists rounded up to help Republicans celebrate their tax-cut victory.