Spain's acting Prime Minister Pedro Sanchez speaks with Unidas Podemos' (Together We Can) leader Pablo Iglesias. | Ricardo Rubio - Europa Press

Spanish Socialist leader Pedro Sanchez's hopes of staying on as prime minister suffered a setback on Thursday when supporters of the Podemos voted to back him only if the far-left party gets key roles in his future cabinet.

Parliament will vote next week on whether to confirm or reject Sanchez as premier, a role he has held on an acting basis since failing to win a majority in a parliamentary election in April. If he is not confirmed in the role, a repeat election is likely for November.

An alliance of the Socialists with Podemos, their most natural political ally, would bring Sanchez almost within touching distance of the parliamentary majority he needs, but the two parties have so far been unable to clinch a deal. Podemos wants top jobs for its leader Pablo Iglesias and others as part of a coalition government, and Sanchez has offered only some lower-ranking posts.