Spanish Prime Minister Mariano Rajoy says he would seek an alliance with other conservatives to prevent a leftist coalition government emerging after Sunday's general election.

Opinion polls suggest that no party will win a majority, likely leaving four main parties looking to forge pacts and form a government. Polls suggest Rajoy's Popular Party will win the most seats in Parliament but lose its majority.

Rajoy had previously declined to discuss possible alliances but told Cope radio Friday he would seek help to prevent a coalition of the two main leftist parties or one comprising eight or more groups, which he said would be bad for Spain.

Campaigning was due to end at midnight Friday.