(CNN) The Armenian parliament has elected opposition leader Nikol Pashinyan as the country's new prime minister, after an outpouring of populist anger against the ruling elite in the former Soviet republic.

Thousands of Pashinyan's supporters, who had gathered in a central square in the capital, Yerevan, to watch the vote on large screens, erupted into cheers when the result was announced.

Pashinyan's victory amounts to a peaceful revolution in Armenia, a small nation of around 3 million people squeezed between Iran, Turkey, Azerbaijan and Georgia. It marks a dramatic split from a corps of leaders who have run the country since the late 1990s, developing a reputation for corruption and cronyism.

The tipping point came two weeks ago when veteran leader Serzh Sargsyan, who had served the maximum two terms as president, was appointed prime minister -- complete with new powers conferred by a controversial referendum he had supported. Many Armenians regarded the job swap as a brazen attempt to maintain his grip on power.

Pashinyan, a former journalist and leader of the opposition Civil Contract party, put himself at the front of the protest movement as thousands of people took to the streets in Yerevan. With his black cap, camouflage T-shirt and bandaged hand -- reportedly injured on barbed wire -- he cut a rebellious figure, contrasting sharply with the suited Sargsyan.

Stung by the protests, Sargsyan stepped down . But his Republican party, which holds a majority in parliament, thwarted Pashinyan's first bid to replace him . In Tuesday's vote, some Republicans switched sides, and Pashinyan won the backing of 59 lawmakers, with 42 voting against him. On both occasions, Pashinyan was the only candidate.

"This is a remarkable shift in Armenian politics," said Laurence Broers, an associate fellow at the Chatham House think tank's Russia and Eurasia program, adding: "The desire for change is coming from within. It is coming from the Armenian streets, from the ordinary citizens."

'The people's candidate was elected'

Within an hour of the vote, Pashinyan traveled to Republic Square in central Yerevan to greet his supporters, who waved Armenian flags and balloons as a rock band performed live music.

Emma Khashmanyan, 27, was one of those celebrating. "We started the velvet revolution without weapons and blood," she told CNN. "And today the people's candidate was elected."

She said she hopes Pashinyan will "clean the system" and "protect the people's interests," adding: "There is no need to keep protesting; now we're just going to celebrate."

Posting a video on Instagram, she wrote, "One day I'll tell my grandchildren about this page of Armenian history, about democracy we've created."

"The ruling Republican Party still has the majority in the parliament but this was a great victory," said Mike Minasyants, another Pashinyan supporter.

He is now looking ahead to the plan the new prime minister will present to parliament, but also hopes the protesting will continue. "People want to protest now against the mayor of Yerevan," he said.

Unlike on previous appearances in the square, Pashinyan wore a suit and was flanked by bodyguards.

At a concert in the city Monday night, Pashinyan had appeared alongside System of a Down front man Serj Tankian, who gave his support to the former journalist and was also present in parliament for the vote on Tuesday.

People cheer in Republic Square, Yerevan, after Pashinyan was elected prime minister.

'Test case' for Russia

Under the constitutional reforms ushered in by the 2015 referendum, the position of president has become largely ceremonial. The prime minister is now the head of government, and controls the army, police, National Security Service and the Security Council.

The result of Tuesday's vote will be watched keenly in Russia. Although the two countries do not share a border, Russia wields considerable regional influence and Moscow is an important provider of military hardware to Armenia.

In a statement issued Tuesday, Russian President Vladimir Putin congratulated Pashinyan on his victory. "I expect that your work as the head of government will contribute to further strengthening the friendly, allied relations between our countries," he said.

Supporters of Pashinyan carry a cake showing his face at a gathering in central Yerevan Tuesday.

While the Kremlin tends to view democratic uprisings with suspicion, Pashinyan has focused his recent criticism on domestic issues. According to Reuters, the new prime minister said on Tuesday that Armenia would maintain strong ties with Moscow and that he hoped to meet Putin.

"This is a real test case for Russia's politics in the former Soviet Republics," said Chatham House's Broers. "There's likely to be a lot of caution from both sides on how to finesse this relationship."

How did Armenia get here?

Armenia's turmoil began on April 17 when Sargsyan, who had previously served two five-year terms as president, was appointed prime minister -- just eight days after his presidency ended.

Thousands took to the streets in protest, driving Sargsyan to step down 11 days later. His deputy, Karen Karapetyan, was named acting prime minister.

According to Broers, discontent with Serzh Sargsyan had been brewing for years. Armenians have seen their country, once the poster child for democratization following the collapse of the Soviet Union, stagnate in the hands of an entrenched oligarchy while many citizens choose to leave, he said.

Pashinyan's supporters celebrate his victory Tuesday.

In response to Sargsyan's appointment as prime minister, Pashinyan called for a campaign of peaceful, civil disobedience, harnessing a widespread desire for change among ordinary Armenians.

Following the failed vote last week, Pasinyan called for a nationwide day of protest . Demonstrators brought roads in Yerevan to a standstill, blocking roads to the main airport and to government buildings.

According to Broers, what matters now is whether Pashinyan can turn his hand to coalition-building skills, "because people have got to get off the street and into institutions."