Authorities issued a tsunami warning for parts of Java’s coastline after the quake struck just before midnight on Friday., local time (4am AEDT).
People ran out of buildings in panic in many areas and Indonesian television showed heavy traffic on roads as people left coastal areas.
National Disaster Mitigation Agency spokesman Sutopo Purwo Nugroho said there were deaths reported but could not immediately provide details.
He also said there were reports that buildings had collapsed in the city of Tasikmalaya in western Java and in several western Java districts.
Mr Nugroho said strong tremors were felt for about 20 seconds in the capital of Jakarta and in cities and villages in western and central Java.
The US Geological Survey said the earthquake had a magnitude of 6.5 and was about 91 kilometres deep and located inland. Indonesian authorities reported a quake of similar magnitude offshore of Java.
Indonesia’s MetroTV said a general hospital in the central Java town of Banyumas was damaged and patients were evacuated.