Australian Prime Minister Julia Gillard has been ousted as Labor Party leader by her predecessor, Kevin Rudd, as party lawmakers hope to avoid a huge defeat in upcoming elections.

Ms Gillard congratulated Mr Rudd on his election as leader of the minority Labor government.

She said she was humbled by having had the privilege to be prime minister, and Australia's first female prime minister.

"When I first put myself forward for consideration as Labor leader in 2010 I had the overwhelming support of my colleagues to do so. I thank them for that,'' she said.


"And I thank them for giving the opportunity to me not only to serve the nation but to serve as the first female prime minister of this country.''

Ms Gillard said she had faced the "twin problems'' of a minority parliament and "internal division'' within Labor.

"It has not been an easy environment to work in.''

Ms Gillard urged Labor MPs and candidates to get out and win the election.

"Don't lack the guts, don't lack the fortitude, don't lack the resilience to go out there with our Labor agenda and to win this election,'' she said.

"I know that it can be done.''

Ms Gillard said there had been a lot of talk about her playing the "gender card''.

"The reaction to being the first female prime minister does not explain everything about my prime ministership, nor does it explain nothing about my prime ministership,'' she said.


"It explains some things and it is for the nation to think in a sophisticated way about those shades of grey."

"What I am absolutely confident of is it will be easier for the next woman and the woman after that ... and I am proud of that.''

The ballot took place three years and two days after Gillard ousted Rudd in a similar internal government showdown. It makes him leader of the party, but not prime minister.

Party official Chris Hayes says Gillard lost 57 votes to 45.

Rudd will likely have to demonstrate that he can command a majority of lawmakers in the House of Representatives before the governor-general makes him prime minister. If he cannot, opposition leader Tony Abbott could be asked to form a government or the elections could be moved up from September to August.

Labor whip Chris Hayes said both contestants spoke before the caucus vote.

"The mood was quite sombre,'' he said.

"Most people are happy that the issue of the leadership is now put behind us so the party can now concentrate on preparing for the September election.''

The meeting took almost an hour to get a result on the leadership because the votes were counted one by one.

"I think the prime minister wanted certainly to advise of her vision and the strength over her leadership in pursuing that vision for the nation,'' he said.

"Any of these challenges, I think, are particularly emotional.

"They're all human beings out there so please take that into account.''

Mr Hayes wasn't able to give any further comment about the meeting which was continuing.

However, it's believed Ms Gillard's deputy, Treasurer Wayne Swan, has resigned his cabinet position.

Mr Swan had previously said he wouldn't serve under Mr Rudd.

Media reports picked the result after Labor cabinet minister Bill Shorten backed Rudd over Gillard.

The vote began at 9pm (NZT) and various media reports said sources inside the caucus room had indicated Rudd had the numbers to win the day.

Mr Shorten said his decision may come at a personal cost to himself.

"It has weighed heavily on my mind in recent weeks,'' he said.

"I have now come to the view that Labor stands the best chance to defend the legacies of this term of government, and to continue improving the lives of millions of Australians, if Kevin Rudd is our leader.''

However, he was a great admirer of Ms Gillard and had supported her loyally for three years since she toppled Mr Rudd from the prime ministership in June 2010.

"I believe she has accomplished remarkable things,'' Mr Shorten said.

But the future of the nation and the Labor Party was at stake because of the Tony Abbott-led coalition.

Mr Abbott represented a "once-in-a-generation risk'' to Australia.

Mr Shorten will offer his resignation as a cabinet minister if Ms Gillard wins the caucus vote.

But he would "enthusiastically'' serve and support whoever was elected leader.

Mr Shorten said he knew some of his friends wouldn't support the choice he had made.

"It is my personal conviction that the best interests of the Australian nation and the Labor Party must come first, not debates about factions of personalities,'' he said.

"I believe that Kevin Rudd being elected leader tonight provides the best platform for Labor to be competitive at the next election.''

He said the achievements of the first and second terms of the current Labor government were many.

"It is these achievements that I want to fight for,'' he said.

"I also believe fundamentally Australians, regardless of their politics, want to see the Labor Party perform as strongly as it can at the next election.''

Prime Minister Gillard called the caucus spill for 9pm (NZT), heading off the circulation of a petition by Rudd supporters calling for a special caucus meeting on the leadership.

"I will be a candidate," Mr Rudd told reporters in Canberra.

"Many, many MPs have requested me for a long, long time to contest the leadership of the party because the parlous circumstances we now face."

Mr Rudd had until Wednesday said there were no circumstances under which he would return to the leadership, after a botched coup in March and after losing a ballot to Ms Gillard in February 2012.

He now believes the leadership must be resolved "for the nation's sake".

"I will leave it to you, the Australian people, to judge ... (if) I have made the right call," the former prime minister said.

He said tens of thousands of voters had been asking him to do it for a long time.

"It is your voices, the voices of the Australian people, it is those voices that have had a huge effect on me, more so than most of the voices I happen to hear around the corridors of this building," the former prime minister said.

Ms Gillard said the leadership must be resolved and it was not right to have a "person floating around as the potential alternative prime minister".

She added politics was about "purpose, not about personality", and listed her government's achievements in boosting schools funding and putting a price on carbon.

Ms Gillard said the loser of the caucus ballot to be held in Parliament House in Canberra should quit federal politics - and Mr Rudd later agreed.

"This is it," Ms Gillard said.

Her decision to call a snap spill followed a meeting in her office with loyalist ministers Wayne Swan, Warren Snowdon, Jenny Macklin, Brendan O'Connor and Stephen Smith.

- AAP / AP