Chinese navy ships off Alaska in recent days weren’t just operating in the area for the first time: They also came within 12 nautical miles of the coast, making a rare foray into U.S. territorial waters, according to the Pentagon.

Pentagon officials said late Thursday that the five Chinese navy ships had passed through U.S. territorial waters as they transited the Aleutian Islands, but said they had complied with international law and didn’t do anything threatening.

“This...