Masayoshi Ohira was elected Japan's new prime minister by parliament today after a bitter factional feud delayed his confirmation by a day.

He immediately appointed a Cabinet seen by observers here as one designed to balance the warring factions in the ruling Liberal Democratic Party.

The only holdover from the Cabinet of the outgoing prime minister, Takeo Fukuda, was Foreign Minister Sunao Sonoda. Sonoda played a key role in reaching a peace treaty with China last August, and the decision to reappoint him was seen as an indication that Ohira did not plan to alter the direction of Japan's foreign policy.

Sonoda is expected to be a key figure in a planned economic summit of the advanced Western nations in Tokyo next summer.

Factions led by Ohira, Fukuda and another former prime minister, Kakuei Tanaka, evenly divided 12 Cabinet posts. Five portfolios were split between two minor factions.

Fukuda's backers boycotted Wednesday's session of the Diet, or parliament, over a dispute regarding the selection of one of Ohira's followers as secretary ageneral of the party, violating a longstanding agreement that the party's powerful second spot would not be filled by a supporter of the prime minister.

After a day of tough negotiation, Ohira and Fukuda agreed on a compromise and said both should do their best for party reform. Fukuda apparently gave in on the dispute over the party secretary general's position, but it was unclear what induced him to change.

Ohira received 380 of the 733 votes cast in both houses of the Diet. He was virtually assured of the top government post after he defeated Fukuda in a party primary Nov. 27 and Fukuda withdrew.

Ohira's new government dropped the Cabinet post of external economic affairs minister, which was held by Nobuhiko Ushiba. Ushiba, who has played a major role in negotiations between the United States and Japan aimed at solving a major trade dispute between the two nations, is likely to be named special representative to the current round of multinational trade negotiations being made in Geneva, according to Foreign Ministry sources.