The country's leader, Kim Jong Un, supervised the launch of the Hwasong-12 missile that reached an altitude of 2,111.5 kilometers (1,312 miles) and flew 787 kilometers (489 miles), according to state news agency KCNA.
The test was "aimed at verifying the tactical and technological specifications of the newly developed ballistic rocket capable of carrying a large-size heavy nuclear warhead," KCNA said.
North Korea warned the United States not to provoke it, saying the "US mainland and Pacific operations" are within range of North Korean missiles.
Analysts called this North Korea's most successful missile test ever and a significant advancement in its quest to build a nuclear-capable intercontinental ballistic missile (ICBM).
The high altitude and long flight time -- 30 minutes, the US said -- indicate a missile with an extended range, according to David Wright, co-director of the Union of Concerned Scientists.
Step towards long range missile?
Guam is home to Andersen Air Force Base, through which the US Air Force rotates heavy bombers including B-1s, B-2s and B-52s.
KCNA said the test showed North Korea "has all powerful means for retaliatory strike" should Washington take any military action to stop its nuclear weapons program.
Tong Zhao, an analyst with the Carnegie-Tsinghua Center for Global Policy, said if the missile does have the range to hit Guam, it could give North Korea "a regional nuclear deterrence," meaning it might not need to pursue an intercontinental ballistic missile (ICBM), which could reach the US mainland.
But Melissa Hanham, senior research associate at the James Martin Center for Nonproliferation Studies in California, said it could be a stepping stone to just that.
"This may become half or a third of an ICBM," she said, pointing out that ICBMs are built in two or three stages stacked atop of each other.
Hanham also said the fact that the missile's re-entry vehicle flew so high above the Earth put it under more stress than a warhead might undergo when fired on a more normal, flatter trajectory
North Korean engineers "may well be able to draw warhead re-entry data from that which is applicable to their ICBM ambitions," said Euan Graham, an expert on North Korea at Australia's Lowy Institute.
"Given speculation over the past months about the possibility of military action by the Trump administration to prevent Pyongyang from acquiring such weapons, the possible testing of ICBM subsystems in this low-key manner may be a North Korean hedge against the possibility of such action," 38 North's Schilling wrote.
Differing assessments
US officials said the missile launched near the city of Kusong, in western North Korea, flew across the country and into the Sea of Japan/East Sea, hitting the water about 60 miles from Vladivostok in eastern Russia.
Russia initially responded to North Korea's test by putting its far eastern air defenses on high alert, according to a report from the RIA-Novosti news agency.
Russian President Vladmir Putin reportedly discussed the launch with Chinese President Xi Jinping during a meeting in Beijing. "Concern was expressed about the escalation of tension, including in connection with the launch (of the missile of the DPRK)," Kremlin spokesman Dmitry Peskov was quoted as saying in Russian state media.
Moon said the missile test violates UN Security Council resolutions and called it a severe challenge to the peace and security of the Korean Peninsula and the world, presidential spokesman Yoon Young-chan said.
South Korea needs to show the North that even though talks are possible, it will only be possible if North Korea changes its attitude, the President told staff.
He said South Korea would respond to provocations.
Messages from Pyongyang?
North Korea's Kim launched Sunday's test as Chinese leader Xi Jinping hosted a major trade and infrastructure summit with multiple world leaders in Beijing.
"It tells China, 'I don't care what you think, I'm independent,'" said Carl Schuster, a Hawaii Pacific University professor and former director of operations at the US Pacific Command's Joint Intelligence Center.
China remains one of North Korea's only allies and is responsible for much of the heavily sanctioned nation's economy.
The United States called for repercussions from the international community.
"With the missile impacting so close to Russian soil -- in fact, closer to Russia than to Japan -- the President cannot imagine that Russia is pleased," a White House statement said.
"Let this latest provocation serve as a call for all nations to implement far stronger sanctions against North Korea," said the statement from White House press secretary Sean Spicer.
China called for restraint by all parties.
"The current situation on the Korean Peninsula is complex and sensitive. All sides should exercise restraint and refrain from taking actions that would further escalate tensions in the region," a statement from China's Foreign Ministry said.
Japanese Prime Minister Shinzo Abe condemned the launch in a quick doorstep interview with reporters.
"Despite strong warning from the international community, North Korea launched a ballistic missile again," Abe said. "This is totally unacceptable and we strongly protest it. North Korea's missile launch is a serious threat to Japan and clearly violate against the UN resolution."
Mixed missile success
The projectile launch comes two weeks after a ballistic missile test that South Korean and US officials said failed.
That missile, launched April 29, blew up over land in North Korean territory, according to a spokesman for the US Pacific Command.
Before Sunday, North Korea had attempted at least nine missile launches on six occasions since Trump was inaugurated in January.
Earlier this month, Trump said he would be willing to meet North Korean leader Kim Jong Un "under the right circumstances."
No sitting US president has ever met with the leader of North Korea while in power, and the idea is extremely controversial.
CNN's James Griffiths, Steve Almasy, K.J. Kwon, Taehoon Lee, Barbara Starr, Junko Ogura, Steven Jiang, David McKenzie. Athena Jones, Liz Landers and Natalie Gallon contributed to this report