Ali Benflis, who leads the ruling National Liberation Front, won the overwhelming backing of his party gaining the votes of 1375 of the 1500 members in an extraordinary meeting that supporters of the current president Abdelaziz Bouteflika had sought to block.
The meeting had initially been scheduled for Saturday but was moved forward after opponents obtained a court ruling asking the interior ministry to ban the congress.
With elections scheduled for April 2004 Benflis is locked in a bitter power struggle with Bouteflika.
Supporters of the latter have been seeking for several months to clip Benflis's wings after an FLN Congress in March gave him broad powers as party leader in place of the current president.
The support for Benflis represents a U-turn for the FLN which backed Bouteflika in the 1999 presidential race and romped to a stunning majority in elections for the state legislature last March.
Bouteflika sacked Benflis as prime minister in May this year, and earlier this week dismissed the last five ministers loyal to him from the governing coalition.
The serving president has yet to announce whether he will stand for reelection.
The FLN has ruled the north African country single-handedly since the country defeated then colonial power France in a bloody independence war that cost one and a half million Algerian lives.
Bouteflika has been president
The country was thrown into another orgy of bloodletting after the army cancelled general elections in 1991 that rival Islamists were poised to win.
More than 100,000 have died in the continuing civil war, although the major Islamist factions have now laid down their arms.
Fifty-eight-year-old Benflis is said to represent the FLN"s moderate, progressive wing. He is an ex-human rights lawyer and a founder of the Algerian human rights league.
In his bid for the FLN leadership he stood on a platform of peace, denouncing the party's old-guard and calling for the inclusion of more female and younger members.
He has also said he wants to provide a balance between the those in the party who want to include Islamists and the extremists known as "the eradicators" who want to destroy them.
Barring any more twists in the leadership tussle Benflis' will enter the elections as the front-runner challenged perhaps only by a president much weakened by the desertion of his party and, if he decides to run, the charismatic former deputy-leader of the Islamic Salvation Front, Ali Belhadj.