Chinese President Xi Jinping offered firm backing for Hong Kong leader Carrie Lam and her attempts to quell the city’s antigovernment protests, signaling Beijing’s intention to keep the beleaguered chief executive in place despite her record unpopularity among residents.

Mr. Xi’s comments to Mrs. Lam on Monday evening, reported by state media hours later, marked the first time he directly addressed the Hong Kong unrest in public remarks since mass protests flared in June, broadly against Beijing’s perceived encroachment into...