The launch, from near Pyongyang, came after the United Nations Security Council imposed an eighth set of measures on the isolated country following its sixth nuclear test earlier this month.
It was by far its largest to date and Pyongyang said it was a hydrogen bomb small enough to fit onto a missile.
In New York, the Security Council called an emergency meeting for later Friday.
The US Pacific Command confirmed Friday’s rocket was an intermediate range ballistic missile (IRBM) and said it did not pose a threat to North America or to the US Pacific territory of Guam, which Pyongyang has threatened to bracket with “enveloping fire”.
Seoul’s defence ministry said it probably travelled around 3,700 kilometres and reached a maximum altitude of 770 kilometres.
It was “the furthest overground any of their ballistic missiles has ever travelled”, Joseph Dempsey of the International Institute for Strategic Studies said on Twitter.
Physicist David Wright, of the Union of Concerned Scientists, added: “North Korea demonstrated that it could reach Guam with this missile, although the payload the missile was carrying is not known” and its accuracy was in doubt.
The North has raised global tensions with its rapid progress in weapons technology under leader Kim Jong-Un, who is closely associated with the programme and regularly pictured by state media overseeing launches and visiting facilities.
The North’s last missile launch, a Hwasong-12 IRBM just over two weeks ago, also overflew Japan’s main islands and was the first to do so for years.
But when Pyongyang tested two intercontinental ballistic missiles in July that appeared to bring much of the US mainland into range, it fired them on lofted trajectories that avoided passing over the archipelago nation.
“The North is sending a message which is, ‘we are not cowering before any sanctions and our warnings are not empty threats’,” Yang Moo-Jin of the University of North Korean Studies in Seoul told AFP.
“It has vowed the US would face ‘pain and suffering’ in retaliation for the UN sanctions.”
– ‘Missile launch!’ –
Millions of Japanese were jolted awake by blaring sirens and emergency text message alerts after the missile was fired.
“Missile launch! missile launch! A missile appears to have been launched from North Korea,” loudspeakers blared on Cape Erimo, on Hokkaido’s southern tip.
Breakfast television programmes, which usually broadcast a light-hearted diet of children’s shows and gadget features, instead flashed up the warning: “Flee into a building or a basement.”
Japanese Prime Minister Shinzo Abe said Tokyo could “never tolerate” what he called a “dangerous provocative action that threatens world peace”.
“If North Korea continues to walk down this path, it has no bright future,” he told reporters. “We must make North Korea understand this.”
Tokyo had protested to Pyongyang in the “strongest words possible”, chief government spokesman Yoshihide Suga added.
The missile overflew the US ally for around two minutes, reports said, but there were no immediate indications of objects falling onto Japanese territory.
US Defense Secretary James Mattis said Pyongyang had forced “millions of Japanese into the duck and cover”, reports said, while Secretary of State Rex Tillerson urged China and Russia, Pyongyang’s main defenders, to take “direct actions” to rein it in.
The launch came a day after a North Korean organisation warned of a “telling blow” against Japan, accusing it of “dancing to the tune of the US” for supporting fresh UN sanctions.
“The four islands of the archipelago should be sunken into the sea by the nuclear bomb of Juche,” the Korea Asia-Pacific Peace Committee said in a statement, referring to the North’s national philosophy of “Juche” or self-reliance.