The Solomon Islands opposition leader Manasseh Sogavare has been chosen as the nation's new prime minister.
Manasseh Sogavare is the second PM elected in three weeks
The original choice, Snyder Rini, resigned last week after his election sparked riots in the capital, Honiara.
Mr Sogavare, who also served as prime minister between 2000 and 2001, pledged to end corruption.
Hundreds of foreign troops and police are in the Solomons, having been deployed when the anti-Rini protesters began damaging property and businesses.
Mr Sogavare defeated his main opponent Fred Fono by 28 votes to 22 in a secret parliamentary ballot, spokesman Johnson Honimae said on Thursday.
His election was greeted by cheers from the hundreds of people who had gathered outside the parliament building to await the result.
"The parliament has made a decision for change," Mr Sogavare told the crowd. "This is an important change that people in the Solomons have been looking forward to."
He pledged his government would "address the underlying issues that caused the crisis in our country".
But Australian Foreign Minister Alexander Downer warned last week that regardless of who was elected as the nation's new leader, the Solomons would struggle to bring an end to corruption and political instability.
Rates of poverty and unemployment in the Solomons also remain stubbornly high, says a BBC correspondent, Phil Mercer.
Mr Sogavare's election comes only three weeks after Sydner Rini was elected to the post.
But almost as soon as Mr Rini was announced as the premier on 18 April, protesters began claiming that either China or Taiwan had paid lawmakers to vote for him.
Riots broke out in Honiara, and many Chinese businesses were looted during the violence. Parts of the city were left in ruins.
Mr Rini resigned eight days after his election, when several members of his government - including Mr Sogavare - defected to the opposition.
His decision to step aside came just before MPs were due to vote in a no-confidence motion against him.
Two politicians opposed to Mr Rini's election have been charged in relation to the riots and remanded in custody.
But both were allowed to vote from their cells in the latest leadership ballot.