The Senate, spurred by public criticism of the recent congressional pay raise, overwhelmingly approved a new code of ethics yesterday for senators and top aides. The vote was 86 to 9.

The measure was steered to passage by Gaylord Nelson (D-Wis.), chairman of the committee that wrote it, after two weeks of sometimes-vitriolic debate. Nelson got strong support from Majority Leader Robert C. Byrd (D-W. Va.), who put his personal prestige on the line. Although he said, "I think it's absurd that the Senate has to demean itself by enacting a new code," Byrd called it absolutely necessary to restore public confidence after Watergate and other government wrongdoing.

Nelson termed the new code a milestone for the Senate. As an addition to the Senate rules, it is binding without further action, but the maximum penalty that can be imposed is expulsion. To impose criminal penalties or fines, an act of Congress signed by the President is needed. The House, which on March 2 passed a code for itself quite similar to the Senate's, is already beginning to draft such a law. Nelson predicted its enactment this summer.

Nelson said the heart of the Senate code is full public disclosure of income and property holdings by members, aides and their spouses.

The code in addition limits to $8,625 a year a senator's total outside earnings from speeches, articles, jobs, serving on a company board or practicing a profession. However, it doesn't impose any limit on income from stocks, bonds, bank accounts, rents, royalties or property transactions.

Income from a family business also is unrestricted as long as the senator doesn't spend significant time on it while the Senate is in session.

The House has a tighter provision on this, imposing the ceiling on portions of family-business income attributable to a member's work. Portions counted as return on investment would be unlimited.

Other Senate provisions restrict receipt of gifts, impose some limits on practicing a profession, bar members from lobbying the Senate for a year after leaving it, wipe out unofficial office accounts (so-called "slush funds") and "lame-duck" junkets, and provide for auditing of financial reports and handling of ethics complaints by the Senate ethics committee.

Before passing the resolution, whose various parts will go into effect automatically at specified dates, the Senate killed, 63 to 31, a move by Minority Leader Howard Baker (R-Tenn.) to terminate the code on March 1, 1981.

Although Baker supports the code, he favors an eventual Congress of "citizen-legislators" who would meet only six months a year, get half their present $57,500 pay, and spend the rest of the year on normal jobs at home in order to "reimmerse themselves in the mainstream of American life."

Baker said the income limits in the new code would prevent that, so the Senate should take a new look in three years.

Dick Clark (D-Iowa), a co-author of the code, said the public would interpret the Baker amendment to mean that "when the heat dies down, our code will quietly self-destruct."

The chief criticism of the new code came from Edmund S. Muskie (D-Maine), who said it would be unfair to limit a Senator's outside earnings from speeches while those with huge stock holdings pile up dividend income without restrictions.

The nine who voted against the code were Carl T. Curtis (R-Neb.), Barry Goldwater (R-Ariz), Clifford P. Hansen (R-Wyo.), S. I. Hayakawa (R-Calif.), Paul Laxalt (R-Nev.), William V. Roth (R-Del.). Harrison H. Schmitt (R-N.M.), Malcom Wallop (R-Wyo.) and Lowell P. Weicker (R-Conn.).

The five not voting were Muskie, Daniel K. Inouye (D-Hawaii), James B. Pearson (R-Kan.), Warren G. Magnuson (D-Wash.) and John Tower (R-Tex.). Although not voting, Magnuson was announced as for passage and Muskie against.

In detail, KEY PROVISIONS:

Require a senator and high-paid employees to report publicly on earned income from work, honoraria, jobs and fees; on gifts over $100 or, if in the form of transport and lodging, over $250; on dividends, interest, rents and royalties by category of value ranging from "under $2,500" to "over $100,000"; and on holdings and transactions in real estate, business property, stocks, patent rights, debts and the like by category of value ranging from "under $5,000" to "over $5 million." Similar reports would be required on the financial situation of a spouse and child, unless the senator or employee could prove he had no connection, no benefit or future benefit, no joint use of their money, and it wasn't used for any common purpose such as support of the household, vacations, school fees, and the like.

House provisions are substantially similar. Effective date: Oct. 1, 1977; first report to be filed May 15, 1978. The Senate version includes audits by the General Accounting Office once every six years, and gives the auditors access to tax returns as well as the above reports.

With certain exceptions, ban gifts of over $100 to a senator, an employee or their spouses and children from a registered lobbyist, an organization with a political action committee or a foreign government or business, or any other foreign source with an interest in legislation. Effective date: Today.

Limit income from jobs, salaries, honoraria from articles and speeches and other personal services to 15 per cent of the salary of a senator or employee (this works out to $8,625 for a senator), with the further limit that an honorarium cannot exceed $1,000 (House: $750). However, the following aren't considered earned income under this limit: dividends, interest, rents, royalties, return on investment in a partnership or family business, or salary from a family business if services are primarily managerial and aren't performed on Senate time. Effective date: Jan. 1, 1979. Tge House version is similar but not identical.

Permit a senator or employee to serve on the board of a publicly held corporation only if elected to it two years before coming to the Senate. Any pay would be subject to the $8,625 limit. Senators and high-paid employees couldn't practice professions like law or medicine except (1) alone, without partners or professional employees, (2) outside regular Senate office hours, (3) subject to the $8,625 limit. Effective date: April 1, 1978. The House code doesn't restrict professional practice or service on boards at all, but subjects any such income to the $8,625 limit.

Bar receipt of unregulated funds for "unofficial office accounts" to supplement congressional allowances, as does the House (both immediately), but allow political contributions to be used for the same purposes. The House barred that and raised allowances $5,000 a year instead. Both codes forbid pocketing leftover campaign funds.

Ban travel by lame-duck senators (similar to the House ban), effective immediately, and prohibit franked mass mailings and use of Senate TV and radio studio facilities for 60 days before an election or primary, effective Aug. 1, 1977.

Require the ethics committee to investigate complaints.