Japanese authorities have issued a tsunami warning and told people to evacuate after an earthquake off the country's northeastern coast.