Former Australian prime minister Kevin Rudd has defeated current Prime Minister Julia Gillard in a Labor Party leadership challenge.

The leadership coup comes with elections less than three months away.

The ballot took place three years and two days after Ms Gillard ousted Mr Rudd in a similar internal government showdown to become the country's first female prime minister.

Although many Labor politicians preferred her style, her deepening unpopularity among voters compelled a majority to seek a change ahead of elections that are set for 14 September, but could be held in August.

The 57-to-45 vote makes Mr Rudd leader of the party.

Governor-General Quentin Bryce could make him prime minister as early as tomorrow, but Mr Rudd likely will have to demonstrate that he can command a majority of politicians in the House of Representatives.

Labor depends on independents and a minor party for its fragile ruling coalition, but Mr Rudd appeared capable of retaining it after two independents who did not back Ms Gillard's government said they would support his.

The ballot ends a bitter rivalry between Ms Gillard and Mr Rudd that helped create an atmosphere of chaos and disunity.

Ms Gillard had survived two previous attempts by Mr Rudd to take over.

She had vowed to quit parliament at the next election if she lost, and said after the vote that she would fulfil that pledge.

She said she was proud of her government's achievements, including the introduction of an unpopular carbon tax paid by the biggest industrial polluters.

Ms Gillard, who made international headlines for calling opposition leader Tony Abbott a misogynist, also hit back at critics who accused her of playing the gender card.

Because of her tenure, she said, "it will be easier for the next woman and the woman after that and the woman after that. And I'm proud of that."

After her statement to the press, she went to the governor general to tender her resignation.

Ms Gillard threw open her job to a party leadership ballot in response to reports that Mr Rudd's supporters were pushing for a challenge, and he soon announced he would run against her.

"We are on course for a catastrophic defeat unless there is change," Mr Rudd said before the ballot.

"And so today, I am saying to you, to the people of Australia, I'm seeking to respond to your call that I've heard from so many of you to do what I can to prevent Mr Abbott from becoming prime minister."