The quake destroyed a number of houses in the area
The quake of preliminary magnitude 6.8 struck off the coast of Niigata, some 260km (160 miles) north-west of Tokyo, Japan's meteorological agency says.
A number of houses were damaged, and a fire started at the Kashiwazaki nuclear plant. But officials said there was no risk of a radiation leak.
Waves up to 50cm (20 inches) high were reported to have hit the coast.
The tremor also swayed buildings in Tokyo.
'I was so scared'
The earthquake hit the country at 0113 GMT, the meteorological agency says. The epicentre was about 60km (37 miles) south-west of Niigata.
Some wooden buildings in the Niigata area collapsed, injuring and trapping more than 100 people, Japan's media said.
Black smoke was seen billowing from the Kashiwazaki nuclear power station, after a fire started at an electricity transformer building.
But the reactor - like several others - shut down automatically, and there was said to be no risk of any radiation leak.
One of the worst-hit areas appears to be the city of Kashiwazaki - close to the quake's epicentre.
"I was so scared - the violent shaking went on for 20 seconds. I almost fainted through fear of the shaking," local resident Ritei Wakatsuki told the Associated Press news agency.
Water and gas was cut off to the city's 35,000 households, and in Niigata 27,000 houses were without power.
A tsunami warning was issued, but it was later lifted.
In Tokyo, buildings swayed and bullet train services were briefly suspended.
The government has set up a crisis management headquarters to deal with the impact of the tremor.
Earthquakes are common in Japan, which is situated in one of the world's most seismically active areas, and the country regularly holds safety drills.
In October 2004, an earthquake with a magnitude of 6.8 struck Niigata, killing 65 people, and in 1995 a magnitude 7.2 tremor killed more than 6,400 in Kobe.