Japan's Prime Minister Shinzo Abe said the two countries were working to counter the "dangerous aggressions" from North Korea, while Trump said he will work with Tokyo to sort out problems on trade.
The time for "strategic patience" with North Korea is over, US President Donald Trump warned on Monday, after winning Japan's backing for his policy of considering all options to rein in the rogue state.
Trump described the North's nuclear programme as "a threat to the civilised world and international peace and stability" on the second day of his Asia tour dominated by the crisis.
The president has signalled in the past that Washington could look beyond a diplomatic solution to the North's nuclear weapons ambitions and consider military intervention.
"The era of strategic patience is over," he declared alongside his host, Japanese Prime Minister Shinzo Abe.
He also said that Japan would shoot North Korean missiles "out of the sky" if it bought the US weaponry needed for doing so, suggesting Tokyo take a stance it has avoided until now.
“He [Abe] will shoot them out of the sky when he completes the purchase of lots of additional military equipment from the United States," Trump said, referring to the North Korean missiles. "The prime minister is going to be purchasing massive amounts of military equipment, as he should. And we make the best military equipment by far.”
Abe, for his part, said Tokyo would shoot down missiles "if necessary".
TRT World's Kieran Burke reports.
Trump is on the second day of a 12-day Asian trip that is focusing on both trade and North Korea's nuclear missile programmes.
Under former president Barack Obama, the US had ruled out engaging the North until it made a tangible commitment to de-nuclearisation.
Washington hoped sanctions pressure and internal stresses in the isolated country would bring about change, but critics said the policy gave Pyongyang room to push ahead with its nuclear ambitions.
Close ally Abe echoed Trump's remarks, voicing Japan's support for Washington's policy that "all options are on the table" to deal with the North Korean threat – including military force.
Abe, whose country is in the firing line of North Korean missiles, also announced Japanese sanctions on the assets of 35 North Korean groups and individuals.
The United Nations has adopted multiple rounds of sanctions against the reclusive North, the most recent in September following its sixth nuclear test and a flurry of missile launches.
Earlier, Trump had appeared to adopt a more conciliatory tone towards North Korea, saying he would not rule out talks with its bellicose young leader Kim Jong-un.
"I would sit down with anybody," he said. "I don't think it's strength or weakness, I think sitting down with people is not a bad thing," he said in a television interview.
"So I would certainly be open to doing that, but we'll see where it goes, I think we're far too early."
And the president again praised the "great people" of North Korea, adding, "they are under a very repressive regime" and that he hoped it "works out for everyone."
But Pyongyang showed no sign of let-up in its attacks on Trump, with ruling party newspaper Rodong Sinmun calling him the "lunatic old man of the White House" and saying there was no telling when he would start a nuclear war.
Trump had earlier praised Japan for buying US military hardware.
But he added that "many millions of cars are sold by Japan into the United States, whereas virtually no cars go from the United States into Japan."
Japan had a $69 billion trade surplus with the United States last year, according to the US Treasury Department. The United States was Japan's second biggest trade partner after China, while Japan was the United States' fourth largest goods export market in 2016.
Japanese officials have countered US trade complaints by noting Tokyo accounts for a much smaller slice of the US deficit than in the past, while China's imbalance is bigger.
In a second round of economic talks in Washington last month, US Vice President Mike Pence and Japanese Finance Minister Taro Aso, who doubles as deputy premier, failed to bridge differences on trade issues.
The two sides are at odds over how to frame future trade talks, with Tokyo pushing back against US calls to discuss a bilateral free trade agreement.
Trump also said earlier that an Indo-Pacific trade framework would produce more in trade than the Trans-Pacific Partnership pact pushed by his predecessor but which he announced Washington would abandon soon after he took office.
The 11 remaining nations in the TPP, to which Japan's Abe is firmly committed, are edging closer to sealing a comprehensive free trade pact without the US.
Trump met Emperor Akihito, exchanging a handshake and nodding, before his lunch and talks with Abe.
He also met relatives of Japanese citizens abducted by North Korean agents decades ago to help train spies, calling the kidnappings a "tremendous disgrace" and pledging to work with Abe to bring the victims "back to Japan where they want to be."
"I think it would be a tremendous signal if Kim Jong-un would send them back," Trump said. "If he would send them back, that would be the start of something, something very special."
Abe has made resolving the emotive abductions issue a keystone of his career. The families hope their talks with Trump – the third US president they have met – will somehow contribute to a breakthrough, although experts say progress is unlikely.
Abe, at the start of a working lunch with Trump, offered his "heart-felt condolences" for the victims of a gunman who massacred at least 26 worshippers at a church in Texas.
White House spokeswoman Sarah Sanders said Trump, who earlier expressed grief for the victims, had no plans at this time to change the schedule for his 12-day Asian trip, which will also take him to Seoul, Beijing and Danang, Vietnam.