New Zealand's main opposition Labor Party elected David Cunliffe as its new leader to contest next year's general election and try to prevent Prime Minister John Key from winning a third term.

Cunliffe, 50, won the vote among caucus colleagues, party members and affiliated unions, the Labor Party said Sunday. He beat deputy leader Grant Robertson and Maori Affairs spokesman Shane Jones to the job, which was vacated by David Shearer last month.

Cunliffe must now unify the Labor Party and boost its public support if he is to stop Key from gaining another term in the next election, due in late 2014. Labor had 33 percent support in a poll of voters in late July, trailing Key's National Party, which had 46 percent.

"We must beat John Key in 2014, and we will only do that by mobilizing the entire party, the affiliates, the membership and the Caucus," Cunliffe said in a statement. "If we can combine the best of all of us, the winners will be the people of New Zealand."

Shearer, who scored 13 percent as preferred prime minister in the July poll, compared with 41 percent for Key, resigned Aug. 22, saying he no longer enjoyed the confidence of all his colleagues.

Cunliffe previously challenged Shearer for the party leadership and may have been viewed as more electable than Robertson and Jones because he represents an electorate in Auckland, New Zealand's largest city and home to a third of its population.

Robertson represents the Wellington Central electorate in the capital city and is not as well known as Cunliffe in Auckland.

Jones' reputation was tarnished by revelations in 2010 that he used a taxpayer-funded credit card to pay for porn movies when he was a minister in the last Labor government.