SEOUL, South Korea — President Trump assured South Korea’s acting president on Monday of the United States’ “ironclad” commitment to defend the country, agreeing with Seoul to strengthen joint defense capabilities against North Korea.

Mr. Trump’s assurances came amid anxiety in South Korea over the future of the alliance with the United States. During his campaign, Mr. Trump cast some doubt on the United States’ defense and trade commitments, saying that South Korea was not paying enough to help keep 28,500 American troops in the country.

But speaking by phone to Hwang Kyo-ahn, the acting president of South Korea, Mr. Trump said that the coming visit to South Korea by Defense Secretary Jim Mattis reflected the close friendship of the two countries and the importance of their alliance. Mr. Mattis is scheduled to visit South Korea on Thursday on his first official trip abroad, which also includes a stop in Japan.

“President Trump reiterated our ironclad commitment to defend the R.O.K., including through the provision of extended deterrence, using the full range of military capabilities,” the White House said in a statement after Mr. Trump’s phone conversation with Mr. Hwang, using the initials for South Korea’s official name, the Republic of Korea.