Desperate relatives searched the rubble for survivors after a powerful earthquake flattened houses in central Indonesia, killing more than 3,500 people in this ancient city and nearby towns.

It was the nation's worst disaster since the 2004 tsunami and triggered fears that a nearby volcano would erupt.

The magnitude-6.3 quake struck at 5.54am near the famed Borobudur temple complex as many people were sleeping, caving in roofs and sending concrete walls crashing down.

Thousands were wounded.

Survivors screamed as they ran from their homes, some clutching bloodied children and the elderly.

The worst devastation was in the town of Bantul, where 80 per cent of the homes were destroyed and more than 2,000 people killed. Residents started digging mass graves almost immediately, family members sobbing and reading the Koran beside rows of corpses awaiting burial.

As night fell across the disaster zone - stretching across hundreds of square kilometres of mostly farming communities in densely populated Yogyakarta province - tens of thousands of people prepared to sleep on streets, in rice fields, and in backyards, fearful of aftershocks.

Power was out across much of the region, adding to their terror. After spending hours digging in vain through the smouldering debris, many said they would have to give up their search for relatives or friends until morning.

"It's just too dark," said Sarjio, who was looking for his 40-year-old neighbour, believed to be trapped beneath the remains of her house. "There's nothing we can do now."

President Susilo Bambang Yudhoyono ordered the army to help evacuate victims and arrived with a team of cabinet ministers to oversee rescue operations, telling people "at a time like this we have to unite". He slept in a tent camp with survivors.

The quake was the most recent in a series of disasters to strike Indonesia - from the tsunami that ravaged Aceh province, to a widening bird flu outbreak, to the threat of volcanic eruption from nearby Mount Merapi.

At least 3,505 were killed in the quake, command post officials from each of the affected districts told The Associated Press, two-thirds of the fatalities in devastated Bantul.

"The numbers just keep rising," said Arifin Muhadi of the Indonesian Red Cross, adding that more than 3,400 people were hurt.

Many roads and bridges were destroyed, hindering efforts to get taxis and pickup trucks filled with wounded to hospitals.

Doctors struggled to care for the injured, hundreds of whom were lying on plastic sheets, straw mats and even newspapers outside the overcrowded hospitals, some hooked to intravenous drips dangling from trees.

Bloodstains littered the floor at Yogyakarta's Dr Sardjito Hospital, along with piles of soiled bandages and used medical supplies.

"We are short of surgeons," said Alexander, a doctor who goes by one name. "There are still so many critically injured people here."

By nightfall, health officials at the hospital had tallied 89 dead, but bodies kept arriving and some family members were taking them home before they could be added to the official toll.

The quake cut electricity and phone lines in some areas.

It struck close to the rumbling Mount Merapi, and soon after the temblor a large burst of hot clouds and debris avalanched 3.5 km down its western flank. No one was injured.

Bambang Dwiyanto, chief geologist in the Energy and Mineral Ministry, said the two events did not appear to be directly related, but warned that the earthquake could still trigger a larger eruption.

"It will influence the activities of Mount Merapi, particularly in the lava dome," he cautioned.

A geological researcher at the Indonesian Science Institute, Dani Hilman, said however he did not think the quake was powerful enough to create a large eruption.

The quake also cracked the runway and the waiting lounge at the airport in Yogyakarta, close to the famed Borobudur temple, closing it to aircraft while inspections take place, Transport Minister Hatta Radjasa said.

Officials said the 7th century Buddhist temple, one of Indonesia's most popular tourist attractions, was not affected by the quake. Nearby Prambanan, a spectacular Hindu temple to the south-east, suffered some damage but it was not immediately clear how much, officials said.

Close to a million tourists flock to the temples every year.

One man from Holland died in the quake, but there were no other reports of foreigners killed or injured. US embassy spokesman Max Kwak said he did not know of any American casualties, adding the US was donating $US100,000 ($A131,700) for search-and-rescue efforts and emergency care.

Other governments and international aid organisations also promised money, medical teams, tents and other forms of humanitarian relief.

Indonesia, the world's largest archipelago, is regularly rocked by earthquakes because of its location on the so-called Pacific "Ring of Fire," an arc of volcanoes and fault lines encircling the Pacific Basin.

A 9.1 quake on December 26, 2004 triggered the tsunami that crashed into 11 countries across the Indian Ocean, killing more than 230,000 people, most of them in the Indonesian province of Aceh.

Yogyakarta, about 2,230 km south-east of Aceh, was not affected by the killer waves.