This is the first time it has fired what is thought to be a ballistic weapon over Japan. On the two previous occasions its rockets crossed Japan - in 1998 and 2009 - North Korea said they were for satellite launch vehicles, and therefore not weapons.

The BBC's Rupert Wingfield-Hayes in Tokyo says this latest launch appears to be the first of a missile powerful enough to potentially carry a nuclear warhead.

Residents told to seek shelter

Media playback is unsupported on your device

Media captionFootage on social media appears to show warning alarms triggered by the missile

The South Korean military said the missile was fired eastward just before 06:00 local time (21:00 GMT) from near the North's capital, Pyongyang - which is rare.

Early analysis of the launch suggests the missile:

flew a distance of more than 2,700km (1,678 miles)

was likely to have been a Hwasong-12, a newly developed intermediate range weapon

reached a maximum altitude of about 550km (342 miles), lower than most previous North Korean tests

fell into the North Pacific Ocean 1,180km off the Japanese coast after breaking into three pieces

No effort was made by Japan to shoot down the missile but it issued a safety warning telling citizens in Hokkaido to take shelter in "a sturdy building or basement".

US and Japanese forces have just finished a joint drill in Hokkaido while another annual exercise involving tens of thousands of South Korean and US military personnel is still under way in South Korea.

The North sees these regular military drills involving the US as highly provocative, perceiving them as a rehearsal for an invasion.

Media playback is unsupported on your device

Media captionN Korea's Japan missile: The key questions

Mr Abe said he had spoken to the US president and they agreed to increase pressure on North Korea. The Pentagon meanwhile said the launch did not represent a threat to the US itself but that the military was working to gather more intelligence about it.

In a statement, Mr Trump said: "The world has received North Korea's latest message loud and clear: this regime has signalled its contempt for its neighbours, for all members of the United Nations, and for minimum standards of acceptable international behaviour.

"Threatening and destabilising actions only increase the North Korean regime's isolation in the region and among all nations of the world. All options are on the table."

North Korea's ambassador to the UN, Han Tae-song, defended his country's actions and said they were a response to military drills carried out by the US and its allies in the region.

"Now that the US has openly declared its hostile intention towards DPR Korea [North Korea] by raising joint aggressive military exercises despite repeated warnings... my country has every reason to respond with tough counter-measures as an exercise of its rights to self-defence," he told the Conference on Disarmament in the Swiss city of Geneva.

China warned that tensions on the Korean peninsula had reached a "tipping point" but said the US and South Korea were partly to blame. Foreign ministry spokeswoman Hua Chunying criticised the two countries for their repeated military drills putting pressure on the North.

"After so many rounds and vicious cycles, do they feel they are nearer to peaceful settlement of the issue?" he said, adding that pressure and sanctions would not solve the problem.

Russian Foreign Minister Sergei Lavrov said North Korea "must respect resolutions from the United Nations".

Analysis: Rupert Wingfield-Hayes, BBC News, Tokyo

This is by some measure North Korea's most provocative missile test in a very long time, perhaps ever. Yes, there have been North Korean flights over Japan before, but this is the first time Pyongyang has fired an overtly military missile, with a potential nuclear capability, across Japan.

Early analysis suggests it was a Hwasong-12 missile, first seen at a huge military parade in Pyongyang in April. It was then successfully launched on a high trajectory flight into the sea in May.

Why has North Korea chosen to do this now? Firstly to demonstrate resolve. It shows the regime in Pyongyang is not intimidated by American threats and has not "backed down", as President Trump suggested two weeks ago.

Secondly, Pyongyang needs to test its new missile on a more realistic trajectory. Thirdly, such a test puts a strain on the US-Japan relationship. It makes Japan feel extremely vulnerable and tests US resolve.

There have also been some reports in recent months that North Korea is preparing to carry out its sixth nuclear test.

But last week, US Secretary of State Rex Tillerson said the fact that North Korea had not carried out any missile launches since the UN imposed a fresh round of sanctions was an indication of restraint by Pyongyang.

North Korea's missile programme:

North Korea has been working on its missile programme for decades, with weapons based on the Soviet-developed Scud

It has conducted short- and medium-range tests on many occasions, sometimes to mark domestic events or at times of regional tension

In recent months the pace of testing has increased; experts say North Korea appears to be making significant advances towards its goal of building a reliable long-range nuclear-capable weapon

In July, North Korea launched two missiles which it said were Inter-Continental Ballistic Missiles (ICBMs) capable of hitting the US; experts believe they put parts of the US in range

There is no consensus on how close North Korea is to miniaturising a nuclear warhead to put on a missile