Japan's ruling conservative party did unexpectedly well in early returns from yesterday's elections to fill half the seats in Japan's upper house of Parliament.

In an apparent comeback from the Lockheed scandal and a crushing setback in December's general election, the Liberal Democratic Party regained eight key seats from the opposition Socialist Party and took the lead as counting continued.

If the trend continues, the Liberal Democrats, aided by a handful of conservative independents, will take the 65 seats it needs to maintain an absolute majority in the upper house.

Japanese political commentators, however, predict a close battle that may continue until the last results are announced Tuesday morning. Still to come are the city votes, which traditionally go against the conservatives, atives, and 50 national constituency seats where the polls also say the conservatives will not do well.

The principal opposition party, the internally divided Japan Socialist Party, lost ground as the decline in its popularity evident in the last few elections continued. The Socialists were defending 32 seats and so far have lost eight in single-seat rural constituencies to the Liberal Democrats. The losses are regarded as critical since the Socialists captured the eight closely-contested seats from the conservatives in the 1971 election.

In a typical upset, conservative Hosei Norota, 47, a former bureaucrat, defeated incumbent Socialist Seiji Sawada by 321,000 votes to 285,000 in the northern Honshu prefecture of Akita.

The absence of significant campaign issues favored the conservative Liberal Democrats, who have ruled Japan since 1955 and have guided the country through an era of phenomenal economic growth. The prospect that the Liberal Democrats might lose their majority in the upper house apparently persuaded many votes to swing behind them.

Although disillusioned with their corruption, as revealed by the Lockheed scandal last year, the cautious Japanese voters are seemingly not ready to cast the Liberal Democrats out of office.

Also helpful to the conservatives as they went into the election were external difficulties - fishery negotiations with the Soviet Union, worsening trade ties with the European Economic Community and a dispute over nuclear energy with the United States - which tended to unite the country.

In a conscious effort to minimize the risk of political instability, many Japanese voters spread their votes across the political spectrum.

Television coverage of the count showed Socialist Chairman Tomomi Narita looking exceedingly glum and the Liberal Democrats' secretary general, Masayoshi Ohira, ginning broadly. "It's what we expected," he said.

As chief party excutive and an aspirant to the premiership, Ohira will receive much of the credit if his party succeeds in checking the drift toward coalition rule.

The conservatives pulled out all the stops for this election - campaigning hard and cutting back their candidate list to avoid the wasting of votes on unsuccessful aspirants. Aware that the public is critical of the party's image as a league of old men, the Liberal Democrats offered a batch of young candidates. The younger men took 22 seats, many of them previously held by older conservative incumbents.

The semi-governmental Japan Broadcasting Corp. predicted tonight that with the support of two conservative independents, the Liberal Democrats will emerge from the election with enough seats to keep a minimal majority. Even if the conservatives fall narrowly short of that goal, they will have little difficulty in recruiting parliamentary votes from moderate, centrist opposition parties.