Setting aside unresolved questions about whether Spain will stay in the North Atlantic Alliance, Secretary of State George P. Shultz said today that the first high-level U.S. visit with the new Socialist government here was meant to "tip our hat" to Spanish democracy.

Shultz spent six hours in meetings with Foreign Minister Fernando Moran and the country's new 40-year-old Prime Minister Felipe Gonzalez.

Afterward, senior U.S. officials said there was "not any arm-twisting" by Shultz, nor were the sessions used to try to move forward negotiations on Spain's ultimate decision on membership in the North Atlantic Treaty Organization and the status of four U.S. military bases in the country.

"Shultz told the foreign minister," the senior U.S. official said, "that he did not come as a negotiator but as a friend."

Shultz was abstaining from pressuring the Spaniards apparently in part because such actions could cause a further erosion of public opinion, which already seems tilted against NATO membership.

The United States clearly wants Spain to be a full NATO member, and Spanish officials reportedly stressed in the talks, as they had at the recent NATO meeting in Brussels, that Spain remains a "loyal partner."

Moran, in a toast at a luncheon for Shultz, said, "Spain intends to act as a loyal, solid and cooperative ally. It is Spain's intention to dissipate any cause for friction or misunderstanding," United Press International reported.

Reuter quoted Spanish officials as saying that Moran assured the secretary of state that the Socialist government was not intending to take any hasty decisions on defense matters.

Officials said there was much discussion of the situation in Central America, a subject on which Gonzalez is well versed and a region where U.S. policies have been sharply criticized by Spanish Socialists. U.S. officials said that there was discussion rather than criticism today.

Shultz is the first top Reagan administration official to meet with Gonzalez as prime minister and the first top official from a major Western country to make a visit since the Socialists swept a center-right government from power in elections on Oct. 28.

Although the new government is ideologically distant from the Reagan White House, officials said that the Shultz visit was designed to encourage and deepen relations between the two countries and to put Gonzalez's young regime at ease with respect to Washington.

Shultz said that the meetings served to show that the United States is "very supportive" of Spanish democracy. Right-wing officers seized the Spanish parliament in February 1981 in an attempt to overthrow democratic government.

Gonzalez's government is the third to come to power since the death of Francisco Franco in 1975 and the first leftist government since the 1936 Spanish Civil War

The previous center-right government had led Spain, for the first time, into the 15-nation NATO alliance last year. Gonzalez has called for a review and an eventual public referendum on NATO membership. He has held up integration of Spain's military forces into the alliance's command structure and Spain did not endorse the most recent NATO comnmunique.

An agreement renewing use of military bases, including a vital port at Rota on the Atlantic coast and three air bases, was signed in July by the previous government but has not yet been submitted to the Spanish Parliament for ratification. Here, too, U.S. officials said that there was no U.S. pressure today but added that Spain "clearly seems to want to maintain its security relationship with the United States."

Shultz's visit was big news here, and his low-key style could help repair lingering political damage created by an offhand remark by former secretary of state Alexander M. Haig Jr. in 1981.

Haig had referred to the failed military coup as "an internal Spanish matter," and the remark was quickly exploited by Spanish leftists and used ever since as evidence that the United States condones right-wing takeovers.