Colin Fox has been elected as the new national convener of the Scottish Socialist Party.
Colin Fox celebrates victory at the party conference in Perth
Delegates at the party's annual conference in Perth voted by 252 to 154 in favour of the MSP for the Lothians.
Mr Fox, who was the first to declare his candidacy, defeated fellow contender Alan McCombes, the party's policy co-ordinator.
Mr Fox succeeds long standing convener and Glasgow MSP Tommy Sheridan, who resigned at the end of last year.
Mr Sheridan had thrown his weight behind Mr Fox's campaign.
Mr Fox, 45, and Mr McCombes, 49, had made their final rallying calls to delegates at a hustings meeting in front of more than 500 activists on Saturday.
How they voted
Colin Fox 252
Alan McCombes 154
Spoilt papers 1
Mr Fox declared his candidacy in November after Mr Sheridan said he was stepping down for personal reasons.
Mr McCombes announced his intention to stand last month and said he did not want to see the coronation of an unopposed candidate.
There had been speculation that the vote would be tight but Mr Fox had a majority of almost 100 and he told reporters that this was "largely as anticipated".
He said: "The party will unite and focus on regaining the confidence of the 130,000 people who voted for us in the 2003 election.
Alan McCombes said he will work to ensure a unified party
"I think there is a large reservoir of support out there and we intend to do all we can to tap into that reservoir."
Turning to the general election, Mr Fox said: "We will haunt new Labour on their record on the war in Iraq - and we will haunt the SNP.
"We are passionate about independence and both parties seem to have lost their passion."
The new leader said he would ensure party unity and there would be no divisions between the party's six MSPs and grassroots activists.
He said: "I want to go to those who voted for Alan, principally in Glasgow, and reassure them that rank-and-file democracy is safe in my hands.
"This is never going to be a parliamentary party under my watch."
He added: "I am somebody with two ears and one mouth - and I listen twice as much as I talk."
Mr McCombes thanked those who supported him in the campaign, many of whom came from the "Socialist heartland" of Glasgow.
He said: "I was defeated in a two-to-one vote but considering that my candidature was announced just five days before nominations closed - I entered the race very late and more importantly I was standing as a non-MSP - I think it was a very strong vote.
Tommy Sheridan congratulates the new national convener
"I will now be doing what I can to unify the party behind Colin's convenership.
"I believe Colin will make an excellent convener and I will be working closely with him."
Mr Sheridan said the election had ended a "vacuum" and divisions within the party.
He said: "I am very happy, not only that Colin Fox has won the convenership but has won it so decisively.
"Earlier on when I was talking I said that whether it was one or 100 votes this party would unite behind him.
"The fact that it is 100 votes makes it all the more likely that this party will now get back to what it is good at, which is fighting the Tories, fighting capitalism, fighting wars, instead of having internal squabbles."