Australian Prime Minister Julia Gillard retained power by a tiny, one-seat majority today after winning the backing of two key independent MPs in the first hung parliament in decades.

The country's first woman leader, who came to office in a party revolt just 10 weeks ago, scraped over the line to form a government with support from the "kingmakers" after 17 days of frantic post-election negotiations.

"Labor is prepared to govern," a tired-looking Gillard told reporters in Canberra. "I believe the Australian people, given the closeness of this vote, want us to find more common ground in the national interest."

Welsh-born Gillard, 48, narrowly avoided becoming one of Australia's briefest rulers after Tuesday's dramatic denouement, which followed the knife-edge elections on August 21.

Three "kingmakers" split at the last minute, with cowboy hat-wearing maverick Bob Katter siding with conservative opposition leader Tony Abbott -- who came within a whisker of snatching a shock election victory.

Centre-left Gillard's rule was finally confirmed after a lengthy address by Rob Oakeshott, the last independent to declare, who prolonged the prime minister's agony.

"I will... give confidence and supply to government, and in effect that means confidence and supply in Julia Gillard," Oakeshott said.

Gillard said she felt a "solemn responsibility" after her rebuke by voters, who returned the first hung parliament since war-era 1940 despite a roaring mining-led economy which avoided recession during the global financial crisis.

"There's no walking away, no attempt to in some way not understand, the message from the result in the election," she said.

"The Australian people have sent me, sent the Labor Party, sent this parliament a message... (I have) heard that message loud and clear."

Gillard ended with 76 seats in the 150-seat parliament, with Abbott's Liberal/National coalition on 74, the closest possible margin, capping a rollercoaster period in Australia's usually staid public life.

"The longest election is finally over," said Abbott, conceding defeat.

"The coalition won more votes and more seats than our opponents but sadly we didn't get the opportunity to form government."

Gillard staged a shock party revolt against elected prime minister Kevin Rudd in June and announced polls just three weeks later, hoping to ride a wave of public support.

But her anticipated honeymoon period failed to materialise as many voters turned to the environment-focused Greens, which enjoyed a record ballot share.

The campaign, election and its aftermath have kept Australia's government in limbo for nearly two months, in the worst political crisis since the queen's representative sacked an elected prime minister in 1975.

Both Oakeshott and Windsor said their main priority was picking the side most likely to provide a stable government capable of seeing out its three-year term, and strongly backed Labor plans for a national broadband network.

Their backing of Gillard's government has come at a price, with Labor promising 10 billion dollars (9.1 billion US) in infrastructure to regional areas including funding for better roads and hospitals.

The government's National Broadband Network, under which fibre cable will be laid to some 93 percent of homes and businesses across the vast continent, was also crucial for the rural independents who saw it as a life-changer for those in the bush.

While Gillard's razor-thin majority leaves her scant room for manoeuvre, Australian National University political scientist John Warhurst said there was little imminent threat of the government collapsing and fresh elections.

"I think they'll be stable, for a good length of time anyway... I think they (the independents) all want to reserve the right to give the new government time to make it work," he said.

Gillard now has the opportunity to redeem a chaotic start to her reign, but she admits her small majority may make it difficult to honour election pledges, which include a new mining tax and action on climate change.

A Downing Street spokesman said British Prime Minister David Cameron had congratulated Gillard, and "both leaders emphasised the importance of a strong, friendly and productive relationship between the UK and Australia."

"They touched briefly on Afghanistan, where the leaders underlined their continued support for the mission and the current strategy," the spokesman added.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.