Japanese legislators this afternoon overwhelmingly reconfirmed Yasuhiro Nakasone as prime minister, a post that he now seems certain to retain beyond a theoretical resignation deadline in October.

Nakasone quickly formed a new 21-member Cabinet in which he and chief Cabinet secretary Masaharu Gotoda were the only holdovers.

The new Cabinet is not expected to switch course markedly in policy. But the ruling Liberal Democratic Party's landslide victory in parliamentary elections July 6 is expected to lead Nakasone to pursue his old objectives with a new aggressiveness.

After his reappointment, Nakasone called on party members to refrain from overconfidence. "We must be humble," he told ruling party legislators.

Nakasone, whose assertive style of leadership has made him popular with the Reagan administration, is already Japan's most enduring prime minister in a decade and a half. He has made opening the Japanese market and increasing defense spending themes of his rule.

The new lineup, meanwhile, gives each of the three so-called new leaders of the ruling party -- Kiichi Miyazawa, Noboru Takeshita and Shintaro Abe -- important jobs that will keep them in position to be candidates for prime minister in the future.

Large-scale rotations in Cabinet posts are common in Japan, although this one was more thorough than usual. Under the rules of the game, loyal members of the party receive important jobs in the Cabinet as rewards for long service, even if they have no particular qualifications.

Today's vote in the Lower House of the Diet, as the Japanese parliament is called, was a formality following the electoral victory. Nakasone got 304 of 502 votes cast, with opposition parties voting for their own leaders.

The vote put no limit on Nakasone's stay in office. But analysts here say a consensus has emerged within the party that with the electoral victory under his belt, Nakasone has earned the right to remain as prime minister after Oct. 30, when his second term as party president expires.

Party rules limit the president to two terms. But the rules also allow the party to grant extensions under special circumstances.

Last week, the three "new leaders" met over dinner to discuss the situation and afterward took the unusual step of issuing a written statement, in which they said Nakasone should stay on if "key pending issues" facing the nation had not been settled by Oct. 30.

Here are the major posts in the new Cabinet.

Tadashi Kuranari is foreign minister. He is a senior member of Nakasone's faction in the ruling party. He has no direct experience in diplomacy, although he has served on the party's international economic affairs committee. Some analysts here regarded his appointment as a sign that Nakasone intends to run this ministry himself.

The minister of international trade and industry is Hajime Tamura, a senior figure in the party faction of former prime minister Kakuei Tanaka.

"New leader" Miyazawa is finance minister. In his quest for the prime ministership, Miyazawa has called for the government to be more flexible in using deficit spending to stimulate the economy, a step U.S. officials would like to see.

The new director general of the Defense Agency, Japan's equivalent of the Pentagon, is Yuko Kurihara. He has held the job in a previous Nakasone Cabinet and was popular with U.S. defense officials.

"New leader" Abe resigned as foreign minister, and becomes chairman of the party's executive council.