United States defence secretary James Mattis says President Donald Trump should seek a diplomatic solution with North Korea.

His remarks come after Mr Trump tweeted that diplomatic solutions were no longer viable between the two countries.

Russia has also warned the US against taking military action, saying the consequences would not be favourable.

North Korea caused alarm by firing a missile over Japan on Tuesday.

The missile, which Japan described as a threat, crossed the Northern Hokkaido region triggering public alerts to take cover before landing in the sea about a thousand kilometres off the coast.

North Korea later said it was of wider military operations in the pacific and repeated its threats to the US pacific island of Guam.