Spain's ruling Socialist Party won a decisive victory in today's municipal and regional voting five months after the party gained an outright legislative majority in national elections.

Preliminary results in polling for city halls and seats in 13 regional parliaments indicated that the Socialist vote surpassed that of the conservative Popular Alliance party by almost two to one.

The Socialist Party claimed victory early Monday, The Associated Press reported. With 57 percent of the ballots counted from Sunday's elections, Vice Prime Minister Alfonso Guerra said the Socialists won absolute majorities in the city councils of 12 provincial capitals, including Madrid and Seville, and had enough seats to control the Barcelona council. The Socialists also were likely to control 11 of 13 new regional parliaments, election officials said.

The results showed the Socialists with about 45 percent and the Popular Alliance with 27 percent. In the Oct. 28 national vote, the Socialists had 46 percent and the Popular Alliance 25 percent. The turnout today was estimated by Interior Ministry officials at 65 percent of the 27 million eligible voters.

The Popular Alliance party, led by Manuel Fraga Iribarne, portrayed the election as a vote of confidence in Prime Minister Felipe Gonzalez's government, but Gonzalez stayed aloof from the campaign.

The Socialist victories appeared to consolidate the political strength of Gonzalez's party at all legislative and administrative levels.

A key exception to the overall trend was in the northern Basque provinces where the Socialists were unable to dislodge sitting mayors of the Basque Nationalist Party. Underlining the separatist radicalization of the area, the Herri Batasuna (People's Unity) party, which is the political front of the terrorist ETA organization, emerged as the third force in the towns of Bilbao and San Sebastian.

The trends also indicated a minor recovery for the Communist Party, which was virtually wiped out last October when it gained only 3 percent of the national vote. The Communists appeared to hold close to 6 percent of the vote in today's election--still only half their showing in the local elections in 1979.

In the ancient town of Cordoba, the only provincial capital won in 1979 by the Communists, the incumbent mayor increased his vote and gained an outright town hall victory.