President Clinton last night won the most important victory of his young administration as a sorely divided Senate approved the heart of his economic program with a tie-breaking vote by Vice President Gore.

The president's plan was in doubt until Sen. Bob Kerrey (D-Neb.) ended weeks of deliberations and announced just before the roll call that he would cast the crucial vote assuring its passage.

"President Clinton, if you are watching now, as I suspect you are, I tell you this: I could not and should not cast a vote that brings down your presidency . . . ," Kerrey said in a stirring floor speech. "You do not deserve and America cannot afford to have you spend the next 60 days quibbling over whether or not we should have this cut or this tax increase."

Kerrey, a rival of Clinton's during the 1992 presidential campaign, admonished Clinton to return to his themes of "shared sacrifice" if he hoped to succeed in reducing the deficit and scaling back the huge federal bureaucracy. Kerrey criticized the plan for not demanding more sacrifice from the middle class.

At the White House, the president jokingly thanked Gore for his "unwavering contribution to the landslide" and lauded Senate Democrats for reversing 12 years of Republican economic policy.

"We are seizing control of our economic destiny," he said. "This is just the beginning, just the first step in our attempts to assert control over our financial affairs, to invest in our future and to grow our economy."

Clinton gave up a lot in steering his budget package through the independent-minded House and Senate. With the Republicans unified against him, he was at the mercy of free-lancing House and Senate Democrats seeking to extract major concessions, including scrapping his proposal for a broad-based Btu energy tax and forgoing large chunks of his "investment" spending plans for "growing" the economy.

But in the process, the president and his Democratic allies in Congress made good on a Democratic pledge to shift more of the tax burden to wealthier Americans and supplement the income of the working poor.

Senate Majority Leader George J. Mitchell (D-Maine), ending debate on the bill, recalled how Democrats reluctantly backed Ronald Reagan's unorthodox "supply side" economic policies more than 12 years ago, and said it was the Republicans' turn to give Clinton a chance.

But Senate Minority Leader Robert J. Dole (R-Kan.), in concluding the Republican attack, dismissed the package as a "terrible bill" that will come back to haunt the Democrats in the next election.

"In a few minutes, all those Americans who are watching on C-SPAN and CNN will put down their remote control and pick up their wallets, because your taxes are about to go up," Dole said.

Through 10 hours of debate, Democrats fended off several last-gasp efforts by Republicans to scuttle the bill, including a challenge to the constitutionality of a provision making the tax increase on upper-income Americans retroactive to Jan. 1.

Republicans hammered away at the bill, calling it Democratic budgetary deception that would do little to reduce the deficit and would undermine the economy with a barrage of new taxes.

Sen. Alfonse M. D'Amato (R-N.Y.), doing an impression of a carnival barker, displayed a blank chart that he said represented the deficit cuts in the bill and shrieked, "We've seen this before -- smoke and mirrors -- and here we are once again. Step right up, ladies and gentlemen, with Magical Bill and his band of liberal magicians."

But the real drama unfolded off the Senate floor. Clinton and his aides sought desperately to unravel the riddle of what it would take to win over the sometimes unfathomable Kerrey. But Kerrey said it was a decision he had to make without any help from the White House.

"It is not my desire to be a Friend of Bill," Kerrey told reporters earlier in the day. "It's my desire to work with President Clinton to get things done, and one of the things we're trying to get done together is deficit reduction."

Few Democrats expressed enthusiasm for the bill, and many said they supported it because it was the only viable alternative to doing nothing. Some, like Sens. Donald W. Riegle Jr. (D-Mich.) and David Pryor (D-Ark.), conceded they were uncomfortable with the retroactive feature of the tax increases, and others said Clinton had not delivered on his promise of a bold change.

"I feel very strongly that more could have and should have been done to deal with the national crisis that we face," said Sen. John F. Kerry (D-Mass.).

"What Americans want, even many of those who didn't vote for President Clinton, is bold action informed by principle," said Sen. Bill Bradley (D-N.J.). "Judged against this standard, today's choice is somewhat disappointing."

However, Bradley said, "We have with this package finally broken the pattern of irresponsibility and indifference that governed the past 12 years."

Clinton's budget package, a mix of tax increases and spending cuts designed to reduce projected deficit spending by $496 billion over five years, barely passed the House Thursday night, 218 to 216, after a frenetic day of lobbying and dealmaking by the president and his senior aides. Forty-one Democrats deserted Clinton and voted against the bill.

Last night's vote was a virtual replay of the Senate vote June 25, when Gore broke a tie shortly after 3 a.m. on an earlier version of the plan to keep it alive. This time, the difference was that Sen. David L. Boren (D-Okla.) switched from support to opposition, and Sen. Dennis DeConcini (D-Ariz.) reluctantly took his place after extracting concessions from the administration.

Once again, all the Republican senators voted against the plan and Democratic Sens. Richard H. Bryan, Bennett J. Johnston (La.), Frank R. Lautenberg (N.J.), Sam Nunn (Ga.) and Richard C. Shelby (Ala.) repeated their no votes.

According to Democratic computations, the package will raise taxes by $241 billion and restrain spending growth by $255 billion over five years. More than 90 percent of the new revenue is expected to come from those with incomes over $100,000.

The bill delivered some of Clinton's top priorities: expanded wage subsidies and tax credits for the working poor, increased funding for food stamps and childhood vaccinations, and new tax incentives to promote business investment in depressed urban and rural areas known as empowerment zones.

It aims a personal income tax hike at the top 1.2 percent of taxpayers and increases taxation of Social Security benefits for the top 12.8 percent of recipients.

It also includes tax incentives for business, including an increase in the deduction small businesses can claim for equipment purchases and a cut in the capital gains tax for people who make long-term stock investments in new small and medium-sized businesses.

But to reach victory last night, Clinton accepted many compromises and engaged in the kind of political horse-trading he had pledged to avoid.

His proposed broad-based energy tax, billed as a way to promote conservation and lessen U.S. dependence on foreign oil, was reduced to a 4.3-cents-per-gallon increase in the federal gasoline tax -- something Clinton had campaigned against.

Clinton's proposed increase in the corporate income tax rate was cut in half, his proposed investment tax credit for business was jettisoned, his effort to tighten tax breaks for U.S. corporations doing business overseas and in Puerto Rico was blunted, and his tax hike on Social Security benefits was narrowed.

The president also had to settle for much less money than he wanted for social programs, and he had to accept deeper cuts in Medicare spending than he had proposed.

The constitutional challenge to the retroactive tax increase was the most concerted GOP attack on the bill yesterday. The Supreme Court ruled in 1981 that retroactive tax increases were constitutional, yet Republicans argued that the Democrats' package was improper because it made income and estate tax increases retroactive to a period before Clinton took office.

"I bet it comes as a heck of a surprise to old departed Uncle Louie who never guessed that President Clinton would have the IRS hound him into the afterlife for yet another contribution or investment," Sen. John McCain (R-Ariz.) said. "Can't the administration confine its broken promises to the living and let the dead rest in peace."

Mitchell and Budget Committee Chairman Jim Sasser (D-Tenn.) said the Republicans were hypocrites for attacking a Democratic retroactive tax plan when they went along with four retroactive tax plans during the Reagan and Bush administrations.

Along a nearly party-line division, the Senate voted 56 to 44 to reject the Republican challenge. One of the leading GOP critics of the Clinton budget, Sen. Bob Packwood (R-Ore.), who had presided over retroactive tax changes as past chairman of the Finance Committee, sided with the Democrats.

As a means of slowing the growth in government borrowing, the budget package is a temporary fix. The deficit -- the gap between what the government spends and what it raises in taxes each year -- is projected to decline from $302 billion last year to $201 billion in the fiscal year that begins Oct. 1, 1996, according to the House Budget Committee.

But the following year, the deficit is forecast to begin rising again, propelled by automatic growth in federal programs that provide benefits such as medical care to everyone who qualifies.

The size of the annual tax increases and spending cuts will grow steadily over the five-year period, and most of the pain will be put off until beyond Clinton's four-year term. Sixty-one percent of the spending cuts and 50 percent of the tax increases are set to take place after Oct. 1, 1996, when the next presidential campaign will be in its home stretch.

A big chunk of the $496 billion of total savings depends on future action by Congress on appropriations bills and is not part of the reconciliation bill.

Speaker of the House Thomas S. Foley (D-Wash.), in a meeting with reporters, tried to dampen expectations that the budget battle would be reopened in a major way after Labor Day by Clinton's agreement Thursday to let economizers in Congress have another whack at federal spending.

Foley said the promised "recission session" would come in October but be limited to "two or three amendments -- not a great many."

Staff writer David S. Broder contributed to this report.