Spanish Prime Minister Felipe Gonzalez told parliament today he supported Spain's continued presence in the NATO alliance but added that his Socialist government would seek the progressive reduction of U.S. personnel and military installations on Spanish soil.

The stand was the first public indication of a switch in policy on the North Atlantic Treaty Organization. The Socialists, campaigning two years ago, promised they would hold a referendum on the decision by the centrists then in power to join NATO.

Speaking at the start of a three-day parliamentary debate on the state of the nation, Gonzalez said, "I would not be in favor of renouncing the treaty." However, he endorsed the present policy of remaining outside NATO's military command structure and his Socialist Party's position that a referendum be held on the alliance issue.

Gonzalez went on to say that his government would seek "a progressive lowering of the presence" of the U.S. forces and installations currently in Spain under a defense and cooperation agreement.

About 12,000 U.S. Air Force and Navy personnel are based principally at the major naval base of Rota near the entrance of the Mediterranean, and at the air base of Torrejon, close to Madrid. There are two smaller air bases at Zaragoza and near Seville. The four are technically Spanish bases used jointly.

Gonzalez said that next month he would begin consultations with opposition parties to seek a consensus on his proposals and that he hoped by year's end to have gained the broadest possible agreement on future defense arrangements.

The prime minister said that during 1985 the government would sponsor a campaign to inform the public of the parliamentary defense agreement and that a referendum would be staged "at the beginning of 1986 and before the end of February" 1986. This would be the first time that a NATO member put its continued membership of the alliance to a popular vote.

In addition to supporting a solely political and therefore nonmilitary presence in NATO, Gonzalez recommended that Spain continue its present policy of banning nuclear weapons on Spanish territory.

Severing of military links and the nuclear ban, as well as the planned reduction of the U.S. military presence in Spain, are seen as concessions to public opinion to persuade Spaniards as a whole to vote in favor of NATO in the 1986 referendum.

Gonzalez can clearly count on the support of the conservative opposition, which favors increased links with the alliance. But recent polls indicated that a majority of Spaniards wanted to have nothing to do with NATO.