NEW YORK, Sept 15 (Reuters) - The United States and the U.N. welcomed on Thursday a ceasefire announced between Armenia and Azerbaijan after two days of violence linked to a decades-old dispute between the former Soviet states over the territory of Nagorno-Karabakh.

The fighting, which each side blamed on the other, left more than 170 soldiers dead and threatened to drag Turkey, Azerbaijan's key backer, and Armenia ally Russia into a wider conflict at a time of already high geopolitical tensions.

A ceasefire was agreed between the two sides late on Wednesday, a senior Armenian official said. Moscow, which has a self-defense pact with Armenia and a military base in the country but also strives for friendly relations with Azerbaijan, claimed credit for the deal.

"We welcome the cessation of hostilities between Azerbaijan and Armenia and will continue to work with the parties to seek to cement it," tweeted U.S. Secretary of State Antony Blinken.

A senior U.S. State Department official said on Thursday evening that the ceasefire "appears to be holding."

"But the events of the last week demonstrate the critical need for real progress on a comprehensive peace process that addresses the underlying issues fueling this conflict," the official added.

Before the ceasefire was announced, Armenia's Prime Minister Nikol Pashinyan said Azerbaijani forces had struck and seized several Armenian settlements along their shared border, in territory beyond the disputed Nagorno-Karabakh region. Baku said it was responding to "provocations".

A monitoring mission from the Moscow-led Collective Security Treaty Organisation arrived in Yerevan on Thursday and held talks with defence officials, Tass news agency said. Russia and Armenia are both members but Azerbaijan is not.

U.N. Assistant Secretary-General Miroslav Jenca on Thursday said, "The international community must remain fully committed to a peaceful settlement between Armenia and Azerbaijan."

Politico reported that U.S. House of Representatives Speaker Nancy Pelosi would travel to Armenia this weekend in a show of support, and will be accompanied by U.S. Representative Jackie Speier, who is of Armenian descent.

"We do not confirm or deny international travel in advance due to longstanding security protocols," Pelosi's office said.

Russia said on Thursday it was seeking to reverse any shift in the military balance of the region that had occurred as a result of the fighting.

"We are in close contact with both countries, so as to arrive at a sustainable ceasefire and the return of Azerbaijani and Armenian military to their positions of origin," Russia's ambassador to the U.N., Vassily Nebenzia, told the 15-member Security Council.

The State Department official said: "We do not see any indication that Russian efforts contributed in a positive way towards securing the most recent ceasefire of this week."

Armenia's deputy defense minister told Reuters the conflict risked spilling over into a full-blown war, while some analysts said Baku was trying to take advantage of Russia's war in Ukraine to advance its position.

"This week's events are also a stark reminder that tensions between Armenia and Azerbaijan also have the potential to destabilize the region," the U.N.'s Jenca said.

The fighting was the deadliest in almost two years since a six-week war in 2020 left thousands dead and Azerbaijan made significant territorial gains in and around Nagorno-Karabakh.