The Social Democrats won a mandate to form Portugal's next government in elections today, ousting Prime Minister Mario Soares' Socialists but falling short of gaining a parliamentary majority.

A new party headed by President Antonio Ramalho Eanes emerged in a strong enough position to play a pivotal role in establishing the government that will take Portugal into the European Community in January.

The rise of the Eanes group, the Democratic Renewal Party, signaled a major shift in the balance of political forces. Founded only three months ago, the new party wrested votes from the Socialists to win almost 18 percent of the total, ahead of the pro-Soviet Communists and the Christian Democrats.

Despite its vague political stance somewhere to the left of the Socialists and lack of a clear program, the new party appeared to have swept to prominence with the support of voters weary of the party infighting that has beset Portugal since it returned to democracy 11 years ago.

Today's vote was the first round of a complex struggle that is expected to extend to three other elections within a year.

With nearly all of the country's precincts reporting, the Social Democrats had 29.9 percent of the vote, up from 27.2 percent in the April 1983 elections; the Socialists had 20.7 percent, down from 36 percent; Democratic Renewal 17.9 percent; Communists 15.5 percent, down from 17 percent, and Christian Democrats 10 percent.

With an expected 44 deputies in the 250-seat Assembly of the Republic, Eanes' party will have an important say in the viability of a minority government expected to be formed by Social Democrat leader Anibal Cavaco Silva, a 46-year-old economist and former finance minister.

Eanes' party has made it clear that it will not seek a place in a coalition government. An alliance of Social Democrats and Christian Democrats is unlikely to be strong enough to command a majority.

Portuguese analysts assessed the Democratic Renewal's gains as a clear indication that Eanes could use his stature to lead the party into a key government role when he steps down from the presidency in January to assume its leadership.

The sharp drop in the Socialist vote reflected a swing to the new party but also dissatisfaction with a decline in living standards. The government's two-year austerity program has coped successfully with a foreign debt crisis but provoked a domestic recession.

The Socialists' candidate for prime minister, Antonio Almeida Santos, acknowledged defeat, saying, "We lost the battle but not the war." He said the result was "deeply unjust," because his party had been punished for taking the necessary steps to put the country's finances in order.

Cavaco Silva forced the early election after he wrested control of the Social Democrats in a bitter factional feud in May. He charged the Socialists with reneging on a government program of economic reforms, and in June he pulled his ministers out of the coalition Cabinet, the day after Portugal signed a treaty to join the European Community.

His demands included trimming the massive public sector, selling off farm communes and liberalizing labor laws. But they were seen as a pretext to consolidate support on the right of his party by provoking an election and then fighting an abrasive campaign.