“When The New York Times is under attack, what do we do?” Michael Zorek, a stay-at-home father from the Upper West Side of Manhattan screamed to the crowd. “Stand up! Fight back!” The group boomed back, responding with the mantra as Mr. Zorek shouted again, listing names of news organizations from BuzzFeed to the Public Broadcasting Service.

Dean Baquet, the executive editor of The New York Times, praised the protesters’ efforts. By blocking certain reporters from attending Friday’s open briefing, the president’s press secretary, Sean M. Spicer, “undermines one of the few institutions that has as its role asking tough, independent-minded questions of the president,” Mr. Baquet said.

The Trump administration did not respond to an email requesting comment.

On Eighth Avenue, two men held a large American flag, on which they had written “Press Freedom” in red, white and blue. On a piece of cardboard was a quotation from Senator John McCain, an Arizona Republican: “When you look at history, the first thing dictators do is shut down the press.”

The president has used Twitter to declare the press “the enemy of the American people.” Mr. Baquet disagreed, saying, “I don’t look at us as the enemy of the White House. I look at us as people who are aggressively covering the White House.”

As the protest concluded, some people waved Sunday’s edition of The Times, folded to reveal a full-page advertisement from the newspaper.