President Vladimir V. Putin of Russia ​met with North Korea’s leader, Kim Jong-un, in his first visit to the country in nearly a quarter-century on​ Wednesday, as the two autocrats vowed to build a joint front against ​the United States and ​deepen bilateral ties that Washington fears will include more arms trade.

Mr. Putin is the first major head of state to visit North Korea since the pandemic, highlighting ​its importance to Russia: It is one of the few​ like-minded countries able and willing to supply Moscow with badly needed conventional weapons for its war in Ukraine.

Mr. Kim gave Mr. Putin a red-carpet welcome early Wednesday in Pyongyang, the North’s capital. His energy-starved government flooded downtown Pyongyang with bright lights as the two leaders were driven in the same car — the Russian-made Aurus limousine that Mr. Putin gave Mr. Kim last year — to the state guesthouse​.

Despite sweltering heat, huge crowds were mobilized to a welcoming ceremony​ for Mr. Putin in the ​main square of Pyongyang later Wednesday, complete with goose-stepping honor guards and colorful balloons released into the air​. The crowds waved paper flowers and the national flags of the two nations as Mr. Putin arrived.

Mr. Putin’s war in Ukraine has brought the two leaders closer than ever. They were expected to hold bilateral talks for most of Wednesday, according to Russian state media, before Mr. Putin moves on to Vietnam.