Japanese media including public broadcaster NHK said collapsing walls had killed an 80-year-old man and a 9-year-old girl, and that another man in his 80s was killed after being crushed by a toppling bookcase.
No irregularities were reported at Kansai Electric's Oi, Takahama and Mihama nuclear power stations in Fukui Prefecture, and at Japan Atomic Power Co.'s Tsuruga nuclear plant, also in Fukui, according to the operators.
Japan's Fire and Disaster Management Agency said 307 people have been treated at hospitals in five prefectures, with most of the injured in Osaka. Prime Minister Shinzo Abe said authorities were assessing damage and their top priority was the safety of residents. Tens of thousands of people lost power after the quake, but officials said most areas got electricity back by midday.
"I want you to make your utmost effort to restore public transport as well as gas and water supplies", he added.
Japanese government spokesman Yoshihide Suga says there were no reports of major damage as of 8:30 a.m.
Osaka prefecture, which includes the city and surrounding areas, has a population of 8.8 million.
Train service was suspended across a wide area during the morning commute.
"The floor moved violently".
Quakes are common in Japan, part of the seismically active "Ring of Fire" that stretches from the South Pacific through Indonesia and Japan, across to Alaska and down the west coast of North, Central and South America.
"My parents suffered a blackout and they have no water". It rated the quake at "6 Lower" on its JMA Seismic Intensity scale, meaning the shaking would have been severe enough to make it hard to remain standing.
And after the earthquakes which rocked the country in 2011 and caused damage to the Fukushima nuclear power station, a team of workers took just six days to fix gaping cracks up to 150 metres along a stretch of road north of Tokyo. The friends I'm travelling with were just as shocked.
NHK showed footage of firefighters tackling a blaze that ripped through a home north of Osaka.
Dozens of domestic flights in and out of Osaka were grounded, while train and subway service in the Osaka area, including bullet trains, was suspended to check for damage.
It also sent three reactors into meltdown at the Fukushima nuclear plant, causing Japan's worst postwar disaster and the most serious nuclear accident since Chernobyl in 1986.
Kansai Electric said on its website that around 170,000 homes in the Osaka region were without power.
Shunsuke Kosaka, an Osaka government official, told AFP an evacuation advisory had been issued to 12 households as it was forecast to rain in the region, possibly triggering landslides.