President Reagan won the toughest vote of his presidency yesterday as bare majorities of both parties in the House heeded the argument that the stability of the economy and the government depended on their passing a politically painful recession-election-year tax increase.

In a roll call that pitted senior members of both parties against juniors and the center of the political spectrum against both right and left wings, Reagan won with a congressional coalition different from any he had ever assembled.

House Rules Committee Chairman Richard Bolling (D-Mo.), retiring after 28 years, called it "a unique coalition," unlike any he had seen since the Marshall Plan vote in the post-World War II days of bipartisanship.

Reagan's endorsement of $98.3 billion in tax increases in the next three years divided his Republican Party, which had given him near-unanimous support in passing and protecting the tax and budget cuts of 1981.

It took an enormous White House lobbying effort to avert a debacle on the House GOP side, as many of the younger Republicans revolted against what they believed to be Reagan's betrayal of the principles of conservative economics.

In the end, heroic -- and occasionally heavy-handed -- lobbying persuaded only 103 of the 192 House Republicans, a bare majority, to vote for the bill.

The other 123 votes -- nine more than were needed for passage -- came from the Democrats, while 118 opposed it.

The vote last night in the Senate was more along traditional party lines, with Republicans backing the president, 43 to 11, and Democrats voting against the bill, 35 to 9, along with independent Harry F. Byrd of Virginia.

Earlier, the closing debate in the House featured an extraordinary appeal by the Democratic speaker, Thomas P. (Tip) O'Neill Jr. (Mass.), who turned to the opposition side and asked the younger Republicans to support the president "who elected you." But that plea, like the insistent entreaties of the White House, did not crack the ideological ranks of the younger Republicans.

The freshman GOP class voted against the measure, 30 to 22, and the sophomores, who share the first-termers' anti-tax, anti-spending philosophy, also were against the president, 22 to 14. By contrast, those Republicans first elected in 1976 or earlier voted 67 to 37 with the president.

In a plea as extraordinary in its own way as O'Neill's, one of those senior Republicans, Delbert L. Latta of Ohio, reached back to John F. Kennedy in asking his colleagues to consider, "not what your country can do for you but what you can do for your country."

That argument is what ultimately carried the day, on both sides of the aisle. The rumored threats of financial or political retaliation against straying Republicans attributed to some White House and Republican National Committee officials backfired so badly that they were quickly repudiated.

Most of the straight political deals that were discussed were never consummated. The steel industry got a last-minute break on tax-leasing that made it easier for representatives from steel districts to vote "yes."

But an effort to cut a similar deal for districts with concentrations of government employes -- a cost-of-living sweetener to offset the Medicare tax these employes will now have to pay -- was rejected just before the vote in a curt letter from Office of Management and Budget Director David A. Stockman.

What finally turned the victory to Reagan was the argument that the economy is in such shaky condition that a repudiation by the House of a bipartisan package of tax increases and spending reductions, endorsed by the leaders of both the executive and legislative branches, would be more of a shock than it could stand.

Those in the House who voted against the president quoted his own words repeatedly in the debate, recalling how in last January's State of the Union address and in thousands of campaign speeches, he ridiculed the idea that raising taxes would curb deficits or do anything but feed the spending habits of government.

Those who voted with him managed to overcome the rhetoric and focus on what they said was the reality of the economic and fiscal picture. Rep. Phil Gramm (D-Tex.), a prominent "Boll Weevil," argued, "Now that we conservatives have a tacit majority, the time has come to stop the protesting and start the governing."

Moderate Democrats like Rep. Richard A. Gephardt (D-Mo.) made the same argument. "The real issue," he said, "is whether the House and the Congress can govern." Defeat of the bill would repudiate the disciplines Congress had voted on itself in the earlier budget bill, he said.

Liberal Democrats like Rep. Tom Downey (D-N.Y.) also argued that whether members liked it, "we need the money to govern the next two years."

None of them was wholly persuasive, as the Democrats fragmented. Black Democrats voted 12 to 5 against the measure, although some argued on the floor that its defeat would mean further cuts in social programs.

Democrats from the 10 largest northern industrial states voted 65 to 46 for the bill, which provides an additional 13 weeks of unemployment benefits for two million jobless and embodies reforms of the tax code many of them have long favored.

Democrats from 10 Deep South states voted against the bill, 36 to 28, in part because it doubled tobacco taxes and in part because of philosophical considerations.

For the most part, Democrats considered the vote "a wash" politically, as Rep. Guy Vander Jagt of Michigan, the chairman of the Republican Congressional Campaign Committee, argued in debate. Those who voted for the bill will have a thank-you letter from the president that they can show to ward off Republican charges that they are narrowly partisan.

But most of the Democrats in tough districts voted "no," because, as Rep. Henry A. Waxman (Calif.), who voted for the bill, said, "They figure that Reagan is discredited on the economy , so why should I help him now?"

The Democrats and Republicans who voted for that "mid-course correction" were mostly middle-aged, moderate, and from the mid-section of the country. That has not been a description of the coalition Reagan has led in the past, which has been heavily Republican, heavily conservative, heavily southern and western.

Whether the new coalition is a freak or a portent could shape not only the 1982 elections but also the future direction of the Reagan administration.