BEIJING—Chinese Premier Li Keqiang, addressing an irritant in relations with the U.S., said that China’s government doesn’t ask companies to spy on its behalf and pledged not to do so in the future.

Asked at a news conference on Friday about China-U. S. competition and whether Beijing forces its companies to conduct espionage, Mr. Li first didn’t respond to the spying question but later returned to give an emphatic denial.

“Let...