Spain's Socialist Party swept to victory today, as a record voter turnout yesterday elected the first leftist government here since the Spanish Civil War.

The final tally gave the Spanish Socialist Workers' Party 202 of 350 seats in the lower house, 26 more than the total needed to form a one-party government -- the first in the history of Spanish democracy. Party leader Felipe Gonzalez, 40, will be the youngest among rulers of the world's major countries.

The vote also gave the Socialists a strong opposition, as the right-wing Popular Alliance led by Manuel Fraga won 101 seats, a spectacular rise from its current nine congressional deputies.

The Socialists won 46 percent of the popular total with 9.8 million votes. Fraga's party won 25.3 percent with 5.4 million. The turnout was 76 percent of the 27 million electorate, compared to 68 percent three years ago. The Interior Ministry, in announcing the totals, did not have figures for the less important upper house of the Congress.

In an uncharacteristically subdued victory speech to hundreds of party workers and supporters at the Palace Hotel, across the street from the Congress hall, Gonzalez called on "all of Spain for serenity," which he said was "more necessary than ever to avoid any mistake, any error." He pledged that his government would be one of "dialogue and cooperation to resolve the country's problems."

After reiterating his party's commitment to a neutral foreign policy outside superpower blocs, support for human rights and a special interest in Latin America, Gonzalez made an indirect reference to his pledge to freeze negotiations on Spain's military role in NATO and eventually to hold a referendum on its current membership in the Atlantic Alliance.

"We reiterate our proposal to act in defense of Spain's interests," he said.

With a group of advisers and a slate of candidates for the most part as young as himself, Gonzalez has compared Spain's Socialists to the year-old government of Greek President Andreas Papandreou.

The Socialist program is a moderate one, with emphasis on largely economic changes to lower the 15 percent unemployment and 12 percent inflation.

Even on the NATO issue, like the Greeks, the Spanish Socialists say NATO is not a "priority." Long before they start a campaign to take Spain out of NATO, they will have to confront the issue of four air and naval bases currently used by the U.S. armed forces.

The current bases agreement was negotiated within the NATO framework and informed sources have indicated that the United States is not favorably disposed toward reworking the agreement outside of the Atlantic military alliance.

Perhaps somewhat stunned by his rapid rise in seven years from the clandestine head of an illegal party, Gonzalez -- who did not use notes for campaign speeches -- quietly read the text of his speech. He first called on cheering supporters for "a little calm."

Following his brief appearance at 2:30 a.m., more than an hour after the results were announced, Gonzalez canceled a scheduled news conference and disappeared. He came briefly to an upstairs window later to answer the cries of "Fe-li-pe -- pre-si-dente!" from thousands of cheering fans in the streets below.

The results of yesterday's vote appeared proof of the popular assumption that this third general election in seven years would be the first "real" vote in post-Franco Spain. Preelection polls had indicated that the fear of polarization that has kept a centrist coalition in power for seven years would evaporate and voters would separate into a more natural reflection of the political spectrum here.

The currently ruling Union of the Democratic Center, which governed throughout the transition following the 1975 death of dictator Francisco Franco, continued the collapse that resulted in a call for early elections in August. It won only 13 congressional seats in the powerful House of Deputies.

Former president Adolfo Suarez's new Social Democratic Center won only two. One of the other big surprises was the poor showing of the Spanish Communist Party, led by the aging Santiago Carillo.

The Communists' loss of 19 seats, leaving them with four was seen as a reflection of Carillo's decreasing leadership ability and the attraction of the electorate to the moderation and youth of the Socialists. The party's vote total was 824,000.

Gonzalez's Socialists were able to win more than 50 percent of the house seats with less than half of the popular vote because several minor parties fell short of the minimum needed for representation.

Despite fears that a Socialist victory would provoke a violent reaction from Spain's conservative military, following on discovery of a coup plot just one month ago, the day passed without major incident.

The Army's spokesman, Gen. Antonio Rodriguetoquero, told reporters late last night that "the Army is above any political option, and thus abides by the outcome of the ballot boxes."

Under the Spanish constitution, the new Socialist government is not likely to take power until perhaps the first week in December. After the vote count is certified, a process that may take as long as two weeks, King Juan Carlos I must then call together the leaders of the parties and name Gonzalez as leader of the majority to form a new government.

The new Congress then convenes in a special session at which the majority party will present its program of government. The Congress will then vote to formally elect the new president. Since a new party has never actually won a majority in an election, current President Leopoldo Calvo-Sotelo and the king, in conjunction with the Congress, will decide to amend the rules to avoid a power vacuum.

The enormity of the change here -- more in national psychology than in abrupt new policies -- was visible in the dazed, tired and often young faces of Socialist Party candidates and activists here this morning.

"Why should we scream?" asked Javier Solana, a professor who was number two on the Socialist congressional list for the Madrid district. "We are just happy and satisfied."

Most of those who had gathered in Socialist electoral headquarters contented each other with quiet kisses and hugs. In formal language, Gonzalez announced that the Socialists had won "the honorable duty of directing the government for the next four years."

Recounting the economic difficulties Spain faces, and alluding to its nearly nonexistent government over the past months, he said that "no citizen can feel apart from the lovely task of putting government back together."

"What has won here is democracy," Gonzalez said, "and the Spanish people."

Despite a nervous government and electorate, and dire predictions in the press of a military coup or stepped-up terrorism from militant Basque separatists of radical group ETA, most of Spain was blanketed with a serene calm yesterday.

Interior Minister Juan Jose Roson told reporters that at least 29 young right-wing hooligans, "some belonging to the neo-Nazi National Revolutionary Youth," had been arrested during the past several days.

But the only serious incidents, according to Civil Guard chief Arramburu Topete, were in the Basque industrial center of Bilbao, where two policemen were wounded while trying to defuse a bomb, and a reported bomb threat against Carillo's residence.

Some observers attributed the lack of violence to the firm position taken by the king.

In a meeting with party leaders Wednesday, he reportedly gave his full backing to whatever government should win and said that "95 percent" of all Spaniards wanted peace and democracy.