BEIJING — With a dose of mystery and the flair of a showman, North Korea’s young leader, Kim Jong-un, used his debut as an international statesman on Wednesday to present himself as confident, reasonable — and willing to bargain.

Mr. Kim’s surprise two-day visit to Beijing, his first known trip abroad since taking power, was effectively a reminder of how much he has set the agenda in the crisis over his nation’s nuclear arsenal — and of what a strong hand he has going into talks, first with President Moon Jae-in of South Korea next month and later with President Trump.

Mr. Kim has yet to say what concessions he is willing to make, or what he may demand from the United States in return. But he continued to dominate the diplomatic process, reaffirming his willingness to meet with Mr. Trump and repeating his vague commitment to the denuclearization of the Korean Peninsula in talks with President Xi Jinping of China, according to Xinhua, the Chinese state news agency.

During Mr. Trump’s first year in office, Mr. Kim raced ahead with breakthrough tests of missiles capable of hitting the United States mainland and what he claimed was a missile-ready hydrogen bomb. Then he abruptly changed course and used the Winter Olympics to seize the initiative, surprising the world with a rapprochement with the South and then an offer to meet with Mr. Trump.