The United States' (US) most senior military officer on Friday said North Korea understands that any attack on Japan is equal to one on the US itself and vice versa.

General Joe Dunford, chairman of the Joint Chiefs of Staff, held talks with his Japanese counterpart at the defence ministry in Tokyo, wrapping up a regional tour during heightened tensions with North Korea.

Tokyo remains on alert against potential military provocations by Pyongyang after North Korea threatened to fire missiles towards the Pacific island of Guam, US territory, which would have flown over Japan.

“I think we made it clear to North Korea and anyone else in the region that an attack on one is an attack on both of us,” Dunford told Katsutoshi Kawano, chief of staff of Japan's Self-Defense Forces.

“And that's very, very important for deterrence,” added Dunford, who visited South Korea and China before arriving in Japan.

Dunford added that the US reaffirmed its “ironclad commitment” to the security of Japan on Thursday when Defense Secretary Jim Mattis and Secretary of State Rex Tillerson held talks with their Japanese counterparts in Washington.

During a separate meeting with Japanese Prime Minister Shinzo Abe on Friday, Dunford called the Japan-US military relationship “rock solid”.

Abe told Dunford: “We firmly demonstrated the strength of the Japan-US alliance at a time when the North Korea situation has intensified.”

Earlier in the day, Abe also met the new US Ambassador to Japan Bill Hagerty, who described the two countries' relationship in superlative terms.

“In my personal view this is the greatest alliance on Earth,” Hagerty told Abe, saying he took up his post at a “challenging time”.

On Thursday, Hagerty urged Tokyo to step up its role in the pact in remarks shortly after his arrival.

Japan frequently demands and receives US reassurances over its commitment to defend its ally.

The US and Japan, adversaries in World War II, have forged a decades-long defence alliance and the US stations tens of thousands of troops in the country.

Washington has long encouraged Japan to take on more defence responsibility even though the country is militarily constrained by a US-written constitution imposed after the end of World War II.

In 2015, Abe pushed contentious security bills through parliament that expand what Japan can do to help its ally, such as coming to the aid of US troops under attack.

During his visit to China, Dunford said peace with North Korea is a “possibility”, but warned the US has “credible, viable military options” for dealing with the errant regime.

The US and North Korea have been engaged in heated verbal sparring since Trump warned Pyongyang that it will face “fire and fury” if it continued to threaten the US and other countries with its nuclear weapons and ballistic missiles.

North Korea responded by threatening to aim a missile at the American territory Guam, though later said the operation was suspended.