WASHINGTON — Tuesday was shaping up to be the kind of news day that makes President Trump unhappy: one in which he saw himself losing control of the narrative in the face of wall-to-wall coverage of his Democratic rivals in the presidential primary in New Hampshire.

Mr. Trump had other ideas.

In a provocative early-morning tweet in which he charged, “WOW, BLOOMBERG IS A TOTAL RACIST!,” the president delivered to his millions of Twitter followers leaked audio from 2015 in which Michael R. Bloomberg, the Democratic presidential hopeful and former New York mayor, offered an unflinching defense of stop-and-frisk policing for which he has since apologized.

Originally posted by a liberal blogger on Monday night, the clip underscored one of Mr. Bloomberg’s key vulnerabilities in the Democratic primary as he seeks to convince voters that he is sorry for the aggressive policing tactics his administration used against minorities in New York. In the clip, Mr. Bloomberg can be heard saying that “the way you get the guns out of the kids’ hands is to throw them up against the walls and frisk them.”

For Mr. Trump, it was an opportunity to try to shape the coverage of the Democratic contest more to his liking.