AFTER 12 hours of often heated negotiations at a southern Russian spa, the republics of Armenia and Azerbaijan signed an agreement Sept. 23 to take steps to end their conflict for control of the enclave of Nagorno-Karabakh.For the first time in nearly four years, there is hope of resolving the most bitter of the Soviet Union's ethnic problems, one that has killed hundreds. Credit for the breakthrough lies with Russian President Boris Yeltsin and President Nursultan Nazarbayev of the Kazakhstan Republic, who acted as mediators and signed the agreement to guarantee it would be implemented. "This document is signed. It's a historic act and a historic document," a triumphant Mr. Yeltsin told reporters waiting at the sanitarium in Zheleznovodsk. Simply getting the two sides to sit down for direct talks was itself unprecedented. The Armenia-Azerbaijan talks mark the emergence of Russia, with the support of other republics, as the new effective center of power in the Soviet Union. It also demonstrates the eclipse of Soviet President Mikhail Gorbachev, who pointedly failed to make even nominal progress in halting the fighting. "The document should have been completed earlier," Armenian leader Levon Ter-Petrosyan told reporters, "but it didn't happen because the central authorities claimed the role of mediator." Even a last minute attempt by Mr. Gorbachev to solve the problem proved ineffective. The Soviet leader was preparing his own decree, discussed at a meeting of the State Council - the new leadership body of Gorbachev and republican leaders - on Sept. 16. But the next day, according to reports, Yeltsin and Mr. Nazarbayev decided to act more directly to try to solve the problem. "Yeltsin and Nazarbayev showed that Gorbachev is nobody now in this current situation," says Andranik Migranian, a Soviet political scientist. The huge Armenian crowd that gathered Sept. 22 in the central square of the Nagorno-Karabakh capital of Stepanakert to greet the two men agreed with this assessment. They carried banners proclaiming, "Boris, you are the hope of Karabakh," and chanted "Russia, Russia." "The appearance of Yeltsin and Nazarbayev in Nagorno-Karabakh, besides everything else, means that new superpowers are born which have grabbed this status from the Soviet Empire," wrote the correspondent for Nezavisimaya Gazeta (Independent Newspaper). Yeltsin's strong performance in this crisis contrasts sharply with Gorbachev's virtual passivity during the entire escalation of the Nagorno-Karabakh problem. Karabakh came to symbolize the inability and unwillingness of Gorbachev to deal with the nationalist movements that emerged as the principal rivals to the Communist Party in recent years. "This is the fourth year since the center, including Gorbachev, has been making no moves after it made a gross mistake in 1988," Yeltsin said in his speech to the Karabakh crowd. "Moreover, attempts to solve interethnic problems by force have never been successful. We use our political authority. We realize the complexity of the problem and know it cannot be solved at one stroke.... It should be a peaceful process...of settlements and negotiations by various sides." The mountainous Karabakh region is a largely Christian, Armenian-populated enclave that was placed within the borders of neighboring Azerbaijan, a Turkic-populated republic, by the Bolsheviks in 1923. Complaining of repression, the enclave's government tried in 1988 to rejoin itself to Armenia, a move supported by the Armenians and opposed by Azerbaijan. Ethnic violence against Armenians in Azerbaijan in 1989 and anti-Azeri violence in response prompted a flood of hundreds of thousands of refugees from b oth sides. From the beginning, Gorbachev's government refused to entertain any discussion of a change in the status of Nagorno-Karabakh. In practice, the central government tended to favor the Azeris, who proclaimed their loyalty to the union. They backed the Azeri dissolution of the local Karabakh government two years ago. Soviet armed forces, both Interior Ministry and regular Army units, were sent to keep order, but rapidly join in the conflict. "The center wanted to keep the integrity of the empire," says Mr. Migranian. "The center couldn't be a mediator between two practically independent republics because it didn't want to recognize their independence." Morever, the political expert adds, the center was able to use the Nagorno-Karabakh problem as a tool to keep both within the union. For Azerbaijan, the central government was an ally in the name of preserving the borders intact, while Armenia was faced with the possibility of leaving the union without resolving this. The agreement reached Monday night by no means resolves the Karabakh issue. But it provides ground for serious negotiations based on real concessions from both sides. The key points of the document, according to various reports of its yet unpublished contents, are: agreement to return to the legal status of the territory before the conflict began in 1988; disarming of the armed groups of both sides by Jan. 1 of next year; holding new elections for the local government and restoring its authority; and steps to resettle Armenians deported from villages in and around Karabakh. The initial and crucial concession was Armenia's decision to renounce its claim to the territory in favor of restoring the constitutional authority of the local government that had been dissolved by Azerbaijan and the Kremlin. An important reflection of Yeltsin's new authority was participation in the talks by Soviet Defense Minister Yvgeny Shaposhnikov and Interior Minister Viktor Barannikov. Their troops will now help enforce the agreement. At one key moment in the talks, the Russian Information Agency reports, there was a threat that if a real process of settlement has not begun by the beginning of next year, Soviet armed forces would pull out. Yeltsin's new authority also carries responsibility. "Now he cannot act as a man who is challenging the center," observes Migranian. "Now he is the center."