Felipe Gonzalez was today overwhelmingly elected secretary general of the Spanish Socialist Workers Party with a two-year mandate, after fighting off a challenge from Marxist radicals who had plunged the largest opposition party into a leadership and identity crisis.

Gonzalez and his supporters, representing the moderates within the Socialist Party, gained 85 percent of the votes by delegates at the end of a two-day extraordinary congress and captured all 25 posts on the party's Executive Committee.

In an earlier vote the controversial definition of the party as "Marxist" was dropped and the Socialists agreed instead that "Marxism is a theoretical instrument, critical and not dogmatic, for interpreting and transforming social reality."

Political commentators here believe that the Socialists' gradual moves toward moderation are essential to the consolidation of a parliamentary democracy here. Holding 121 of the 350 lower house seats against the 167 held by Prime Minister Adolf Suarez's Union of this Democratic Center, the Socialists form the only viable alternative to power. But under present circumstances here, they are unlikely to form a government if they remain a radical, ideological party.

At a stormy party conference in May, Gonzalez, 37, the secretary general since 1974, refused to stand for reelection when radicals won a vital debate then appearing to ensure the continued definition of the party as "Marxist." However, the current extraordinary congress was they scheduled to elect the party leadership and agree on Spanish socialism's ideological definition.

The radical contenders for the executive posts failed to obtain more than 6 percent of the vote cast by the delegates. The radicals had accused Gonzalez and his supporters of steering the party toward social democracy and had campaigned for left-wing unity and a closer "understanding" with the smaller Spanish Communist Party.

Despite the rout of the radicals, known as the "critical sector," the party remains staunchly left wing and continues to define itself as a "mass based, class party." Gonzalez, in his acceptance speech, ruled out any possibility of a coalition Cabinet with the governing centrist party and said that Western European social democracy had failed to live up to the expectations of the working class.

But it was also clear that the rejection of the "Marxist" label represented the breaking of a psychological barrier and paved the way for the possibility of Socialists making inroads into the centrist, middle-class vote. Gonzalez, despite his youth, has projected himself as a moderate, mature and realistic political leader.

In his acceptance speech, Gonzalez repeately insisted that Spanish democracy was "fragile and not yet consolidated." He said it was threatened by the economic crisis and by the political violence of the Basque separatist organization ETA, which is Marxist-led and has claimed responsibility for scores of assassinations this year, including those of three senior Army officers in the past 10 days.

Gonzalez directly referred to the threat from "coup plotters," echoing current fears of military opposition to the democratic process. The theme of his speech was that democracy must be consolidated before the party undertakes to build socialism.