And in the most recent campaign finance report, Mr. de Blasio indicated that he had nearly $5 million in the bank. Ms. Malliotakis had just $220,000, and Mr. Dietl had $269,000.

Mr. de Blasio has received about $5 million in donations and $2.8 million from the city’s generous public financing program for campaigns, which gives candidates a six-to-one match for the first $175 contributed by New York City residents. And he stands to receive another sizable injection of matching funds ahead of the general election. Ms. Malliotakis has not yet reached the fund-raising threshold to receive matching funds; Mr. Dietl is not participating in the program.

With 97 percent of electronic scanners reported, Mr. de Blasio received 320,812 votes. Michael Tolkin, a technology entrepreneur, got less than 5 percent; Robert Gangi, a police reform activist, got 3 percent; and Richard S. Bashner, a Brooklyn community board leader, got 2 percent.

In the only other citywide Democratic primary on Tuesday, the public advocate, Letitia James, handily beat her challenger, David Eisenbach, a Columbia University professor allied with Mr. Albanese. She will run in November against the Republican candidate, Juan Carlos Polanco.