The Senate Judiciary Committee yesterday passed the controversial "Illinois Brick" antitrust legislation, giving Sen. Edward M. Kennedy a narrow but major victory in his first test of strength as chairman of that powerful committee.

Approved by a 9-8 vote, the bill, known officially as the Antitrust Enforcement Act of 1979, essentially would offset a 1977 Supreme Court decision in the Illinois Brick case that allows only direct purchasers to sue for price-fixing damages, effectively gutting many class action consumer lawsuits.

The Bill, which is similar to one introducted unsuccessfully last year, would allow consumers, businesses and governments injured by antitrust violations to sue for damages whether or not they dealt directly with the antitrust violator.

The committee vote represented a significant political achievement for Kennedy, who had to overcome an especially vigorous attack from both the Republicans on the committee and the business lobby. The Republicans have promised to filibuster when the bill reaches a vote on the Senate floor.

Two weeks ago, Kennedy postponed a committee vote on the issue when it became apparent he would lose 9-8 because Democratic Sens. Joseph Biden of Delaware and Howell Heflin of Alabama were planning to vote with the committee's seven Republicans against the bill.

But since that time, Kennedy's staff worked closely with one of the Republicans, Sen. Charles McC. Mathias Jr. of Maryland, to make changes in the bill that would win his vote.

In order to win over Mathias, Kennedy's staff made three changes. One allows the court to award attorneys' fees to a defendant in a "bad faith" lawsuit. Another change provided for court supervision of attorneys' fees, and the third provision involved the rights of foreign countries to sue in the U.S. for restraint of trade practices.

The new language foreign governments to sue in U.S. courts for damages in private antitrrust cases only if the U.S. has the same right to take private antitrust actions in those countries.

Kennedy staffers were extremely happy with the victory, but staffer David Boies observed, "We're not even halfway there yet; we still have to get to the floor."

The Consumer Federation of America hailed yesterday's vote as "a great consumer victory."

"We hope today's vote will throw a significant brick in the path of the opposition," said CFA president Kathleen O'Reilly.