Julia Gillard has been sworn in as Australia's first female prime minister after a surprise leadership vote in the ruling Labor Party ousted Kevin Rudd.

Mr Rudd chose not to take part in the ballot knowing he would suffer an embarrassing defeat to his deputy.

Ms Gillard said she believed "a good government was losing its way" and vowed to revive Labor ahead of a general election expected in October.

The party has suffered a sharp drop in support in opinion polls this year.

A turn-around on a carbon trading scheme and a wrangle over a controversial mining tax led to a sharp slide in approval ratings for Mr Rudd's government.

So long as she can wipe the slate clean of Rudd's mess, she should make a great leader David, BBC News website user, Melbourne Your views Profile: Julia Gillard

Ms Gillard, who was deputy prime minister before the surprise Wednesday night challenge to Mr Rudd, stood unopposed at a vote of the Labor Party's 112 members of parliament at a meeting on Thursday morning.

Treasurer Wayne Swan was elected the new deputy leader, also unopposed.

Ms Gillard was born in Barry in south Wales, moving to Australia with her family at the age of four.

Emotional

Emerging victorious from the party vote at Parliament House in Canberra, Ms Gillard told reporters: "I came to the view that a good government was losing its way.

They've changed the salesman but they haven't changed the product Tony Abbott , Liberal Party leader Australia's pioneering Welsh PM

"I believe too I have a responsibility to make sure at the next election that Labor is there at its strongest."

On the issue of a planned "super tax" on mining, which had dogged Mr Rudd, she said she wanted a consensus.

"We need to do more than consult, we need to negotiate... we need to end this uncertainty," she said.

"Today, I am throwing open the government's door to the mining industry and in return I ask the mining industry to open its mind."

On Mr Rudd, she said: "He was the leader who saw us through the global financial crisis.

Analysis The tumble of events has been extraordinarily fast, for at the start of this year the polls suggested Kevin Rudd remained Australia's most popular PM in 30 years - since the days of Bob Hawke. But the pivotal moment came when he decided to shelve the centrepiece of his environmental strategy, an emissions trading scheme. Many thought it was an act of political cowardice - gutless was the oft-heard word. Since becoming leader of the Labor party in 2006, he had always been much more popular with the Australian people than with his colleagues in the Labor party. But after picking a fight with the resources sector over his plans for a super tax on their super profits, the polls slumped again. The party powerbrokers and factional leaders decided the government would fare better at the forthcoming federal election with Julia Gillard at its head. Read Nick's analysis in full

"He came within a breath of brokering an international agreement on climate change."

Mr Rudd, 52, repeatedly choked back tears as he and his family appeared before the media in Canberra.

"I have given it my absolute all and in that spirit I am proud of the achievements we have delivered to make this country fairer," he said.

Mr Rudd said he would devote himself to helping Labor get re-elected, adding that they were "a good team led by a good prime minister".

"I'm proud of the fact that we kept Australia out of the global financial crisis," he said.

"I'm proud of the fact that had we not done so, we would had had half a million Australians out there out of work."

Opposition Liberal Party leader Tony Abbott dismissed the change of leadership, saying Ms Gillard was committed to the "same dud policies" of her predecessor.

"They've changed the salesman but they haven't changed the product," he told reporters.

Fall from grace

Mr Rudd had called a late-night news conference on Wednesday to announce the ballot after Ms Gillard said she would challenge him for the party leadership.

Mr Rudd, who led Labor to a landslide election victory against the Liberal government in 2007, blamed "a number of factional leaders" within the party for plotting against him.

Mr Rudd had initially insisted he would stand in the leadership ballot, but the BBC's Nick Bryant in Australia said that by Thursday morning Mr Rudd could not even muster enough support to contend the ballot.

Mr Rudd started this year as the most popular Australian prime minister in three decades and was widely expected to win the federal election expected in October with ease.

But his popularity plummeted following a number of policy setbacks, our correspondent adds.

He shelved the centrepiece of his environmental strategy, an Emissions Trading Scheme (ETS), which led to accusations of political cowardice.

Mr Rudd then entered into an advertising war with the country's powerful mining sector over his plans for a super tax on their "super profits".