Spanish Prime Minister Felipe Gonzalez named a new foreign minister and minister of economic affairs today in his first Cabinet shake-up since he took office after an election landslide victory by his Socialist Party in December 1982.

Announcing the changes, Gonzalez restated his commitment to Spain's continued membership in the North Atlantic Treaty Organization and said there would be no change in an overall economic policy aimed at controlling government spending and reducing the deficit.

Francisco Fernandez Ordonez was a surprise choice as foreign minister, replacing Fernando Moran, and Industry Minister Carlos Solchaga was promoted to economic and financial affairs minister, replacing Miguel Boyer, architect of the austerity program for the past 2 1/2 years.

New ministers of industry, regional affairs, public works and transport were appointed, and Gonzalez said he intended the new government to last until next summer, when elections are due.

Fernandez Ordonez, 55, is a veteran survivor in Spanish politics. He held top jobs under the late Francisco Franco, went on to hold Cabinet appointments in the center-right administrations that succeeded Francoism and then switched his allegiance to Gonzalez at the time of the 1982 elections.

He is a lawyer and economist who did graduate work at Harvard. He is considered politically a liberal rather than a socialist and is likely to be strongly supportive of the pragmatic, moderate, prowestern policies espoused by Gonzalez.

His appointment marks a departure from the traditional Gonzalez policy of drawing on trusted party lieutenants for government jobs. Fernandez Ordonez was in charge of public sector industries in the twilight years of Francoism but resigned his post shortly before the right-wing ruler died.

Gonzalez denied accounts that Moran was fired because he was anti-NATO. He said Moran had been loyal to the government's policy and had been replaced because following Spain's recent entry into the Common Market, "a new chapter had been turned" in international relations.

Moran's sympathies with nonalignment and his broad distrust of bloc politics were always close to the surface, however, and Fernandez Ordonez, in contrast, has always been cast in a prowestern mold.

The surprise departure of Boyer was, by Gonzalez's account, unplanned. Gonzalez said Boyer had told him he was "tired" of politics and wished to quit and that he had refused entreaties to remain in the Cabinet. Gonzalez pledged that the cautious policies Boyer had introduced would remain the government's economic model.