The epicenter of the quake, which struck at 3:10 a.m. local time, was located in the sea, 116 kilometers southwest of Gunung Kidul, at a depth of 17 kilometers.
The quake did not have the potential to trigger a tsunami, the agency noted.
No material damage or fatality was reported.
A quake of magnitude 5.0 is considered moderate and can cause damage.
Related news: 5.2-magnitude quake jolts Alor district
Related news: West Sulawesi quake: Death toll climbs to 90
EDITED BY INE