The Supreme Court ruled yesterday that foreign companies operating in the United States must comply with federal civil rights laws, upsetting a decades-old policy under which foreign corporations--notably the Japanese--passed over American workers to hire and promote their own foreign nationals.

Trade experts expect the unanimous ruling to touch off a major international trade problem. Threatened are the U.S. investment practices of companies from more than a dozen countries as well as those of U.S. firms overseas that also generally hire and promote U.S. nationals.

The Japanese Ministry of International Trade and Industry had said that a decision like the one rendered by the court would discourage investment by foreign firms in the United States because foreign companies would fear losing control over their businesses by hiring American managers.

However, U.S. Trade Representative William E. Brock said yesterday that the decision shouldn't pose any trade problems.

The discrimination case was brought by 12 women clerks and secretaries against their employer, Sumitomo Shoji America, a New-York-based subsidiary of a Japanese export-import firm. The women charged the company with discrimination by sex and national origin under the Civil Rights Act of 1964 for promoting only Japanese men.

Sumitomo, like other foreign-owned firms that have incorporated here, selected its own nationals as executives regardless of discrimination laws, using as a defense a World War II treaty of friendship, commerce and navigation with the United States. Twenty other countries have such treaties, and Americans have been able to operate in a similar manner when they locate companies overseas.

Japanese companies generally chose men for their executives based on traditional roles of men in Japanese society and as part of corporate policy to give their managers experience in the United States.

In a decision written by Chief Justice Warren Burger, the court said "the purpose of the treaties was not to give foreign corporations greater rights than domestic companies but, instead, to assure them the right to conduct business on an equal basis without suffering discrimination based on their alienage."

Once companies incorporate here, they are considered under the treaties "to be companies of the country in which they are incorporated; they are entitled to the rights and subject to the responsibilities of other domestic corporations."

"The decision indicates if you come into a situation where a foreign corporation takes advantage of the treaty provisions, it will have to obey American civil rights law," said Lewis M. Steel, attorney for the 12 women. "That's a very important concept."

The appeals court had discussed briefly that under certain conditions, Japanese citizenship could be a bona fide occupational qualification for high-level jobs with Japanese-owned firms.

In a footnote, the justices said "there can be little doubt that some positions in a Japanese-controlled company doing business in the United States call for great familiarity with not only the language of Japan, but also the culture, customs and business practices of that country."

However, the justices said the appeals court had presented insufficient evidence to determine whether Sumitomo qualified under those circumstances.