The central committee of Algeria's ruling party relieved its chief Abdelaziz Belkhadem of his duties on Thursday, an AFP journalist reported.
Members of the National Liberation Front held a vote of confidence amid their biggest internal crisis in a decade, with 160 voting in favour of and 156 against the resignation of the secretary general, and seven spoilt ballot papers.
Belkhadem admitted defeat, saying "I have triumphed because my party has triumphed. I quit with my head held high and hope that whoever succeeds me will do better."
His adversaries had feared the influential former premier may force the party to re-elect him.
The FLN, to which President Abdelaziz Bouteflika also belongs, and which holds almost half of the seats in parliament, had been riven between supporters of Belkhadem, 67, and high-profile critics who accused him of nepotism.
Under Belkhadem's leadership, the FLN won back-to-back legislative and local elections, in 2007 and 2012, despite claims of widespread fraud in last year's parliamentary polls.