SEOUL, South Korea — North Korea’s reclusive leader, Kim Jong-un, extended an extremely rare invitation to a foreign head of state on Saturday, using the diplomatic opening created by the Olympics in South Korea to ask its leader, President Moon Jae-in, to visit the North for a summit meeting.

Mr. Kim’s unusual invitation, which was received by Mr. Moon with both caution and optimism, was the latest sign of warming relations between the two rival governments after an exceptionally tense period over the North’s nuclear weapons program.

But the overture by the North also risked driving a wedge between South Korea and the United States, its main military ally, which has been campaigning for “maximum sanctions and pressure” against North Korea.

Vice President Mike Pence, who was visiting South Korea for the Olympics, has used increasingly hostile language against the North in recent days, calling it the most tyrannical regime on the planet and steadfastly avoiding interactions with North Korean delegates at the Games.