MADRID, OCT. 27 -- As a senior Soviet envoy arrived in Baghdad today for another peacemaking attempt, Soviet President Mikhail Gorbachev said he had picked up signals that the Iraqi leadership might be considering new ways to reach a peaceful resolution to the Persian Gulf crisis.

"In recent days, there have been signals that within the Iraqi leadership there is an understanding that a solution of problems cannot be achieved through ultimatums," the Soviet leader said at a joint news conference with Spanish Prime Minister Felipe Gonzalez.

"I may be mistaken, and the coming days perhaps will bring some clarification," Gorbachev added. He said he had dispatched his close adviser, Yevgeny Primakov, on another trip through the Middle East because it was necessary to exhaust "all possible means of finding a political agreement."

Primakov, who has been in Egypt and Syria this week, arrived in Baghdad tonight, his second visit to the Iraqi capital in less than a month. Gorbachev did not explain his reference to Iraqi "signals," but at the United Nations, the Soviet Union at the last minute requested a postponement of a Security Council vote on a resolution that would begin the process of making Iraq responsible for war damages by asking countries to document their financial losses and any mistreatment of civilians. Diplomatic sources said the Soviets asked for the delay to avoid spoiling the atmosphere for Primakov's talks.

In Saudi Arabia, the newspaper Al-Yom, which often reflects official thinking, described Primakov's visit as the "last effort to seek a peaceful solution" and said Iraqi leader Saddam Hussein "should understand this." The paper said the Soviet initiative reflected the effort of a "mediator who enjoys endorsement by all sides" to avert war over Iraq's invasion of Kuwait Aug. 2.

Primakov's last visit to Iraq generated some optimistic press reports about a possible softening of Iraq's position, but U.S. officials who later met with Primakov in Washington could discern nothing in what the Soviet envoy said he was told by Saddam that would indicate that the Iraqis are prepared to withdraw unilaterally from Kuwait.

Gorbachev and Gonzalez, in a political declaration that capped the first visit by a Soviet leader to Madrid, strongly condemned Iraq's invasion and occupation of Kuwait. The Soviet-Spanish statement said Iraq's behavior "constitutes a flagrant violation of the norms of international law" and demanded Iraq's "strict compliance with relevant United Nations resolution by the immediate and unconditional retreat of its troops from Kuwait."

The Soviet Union and Spain also appealed for a new Mediterranean security conference to bring about substantial reductions in the naval forces patrolling the region as the next phase of European arms control.

Gorbachev said the large military presence in the Mediterranean had been neglected because East-West negotiations have focused on cutting conventional forces in central Europe and on the nuclear arsenals of the superpowers.

The Nobel Peace Prize laureate said it was important to redress this "serious delay" by extending the arms control process to Europe's southern flank or else East-West reconciliation could be hindered. He added that Arab countries bordering on the Mediterranean also had expressed a desire to participate in the regional security initiative.

The idea was launched recently by the Spanish and Italian governments in the wake of German unification to attract greater attention to the security problems of southern Europe when the 34 leaders of nations belonging to the Conference on Security and Cooperation in Europe gather in Paris Nov. 19-21.

The Soviet and Spanish leaders noted that the Arab-Israeli conflict has served "for decades as a focus of instability and confrontation" and advocated an international conference to reach "a just, enduring and global solution." They also urged stronger international controls on the export of all weapons and military technology.

Gorbachev's trip to Spain and France is primarily intended to solicit greater help from the West to save the Soviet Union from economic collapse. The Soviet leader said that if such assistance is not forthcoming, "it will put the brakes on our development and we would have to go back to some form of command economy instead of the market."

He acknowledged that the Soviet Union would be particularly grateful to those countries that came to its rescue in this hour of need, saying, "We are preparing a black and red list of how people behave toward us at this time." Besides the declaration establishing closer political relations, Spain and the Soviet Union signed more than a dozen trade, investment and industrial agreements during Gorbachev's trip. The Soviets will receive a $1.5 billion line of credit to buy Spanish consumer goods, mostly food.