WASHINGTON — President Trump complained on Friday that Democrats and the news media were trying to scare Americans about the coronavirus to score political points against him but asserted that the outbreak had been relatively limited because of his action to stem infections.

“They’re doing everything they can to instill fear in people, and I think it’s ridiculous,” Mr. Trump told reporters, referring to CNN and other news outlets. “And some of the Democrats are doing it the way it should be done, but some of them are trying to gain political favor by saying a lot of untruths.”

Speaking on the White House lawn before heading to South Carolina for a campaign rally, the president said the spread of the virus had been limited in the United States because of his order limiting travel from China.

“We haven’t lost anybody yet, and hopefully we can keep that intact,” he said. “There’ve been no deaths in the United States at all. A lot of that’s attributable to the fact that we closed the border very early. Otherwise it could be a very different story.”