There were no immediate reports of damages or casualties. The agency issued a tsunami warning as a cautionary measure, but removed it within minutes.
The quake was centered in the northern part of Saitama Prefecture, a state northwest of Tokyo, and 50 kilometers (31 miles) below ground level, the agency said.
The quake shook all 23 wards of Tokyo, as well as the surrounding prefectures including Ibaraki, Tochigi, Saitama and Gunma.
Japan is one of the most earthquake-prone nations in the world. A magnitude 5 quake can cause considerable image, while a magnitude 6 temblor can cause severe damage.
Quake jolts Tokyo region; no tsunami warning issued