NEW YORK—Before Mayor Michael Bloomberg took control of the school system, none of the state’s top-scoring 25 schools were inside New York City.

Twelve years later, 22 out of the 25 top-scoring schools in the state are blooming in the city.

The schools were ranked based on the scores of third- through eighth-graders on the last round of state tests. Six of the 22 schools are for talented and gifted children. The rest are a mix of traditional public schools and public charter schools.

Bloomberg and several top education officials visited the 22 schools on Sept. 16 to congratulate school staff and students for the unprecedented achievement.

“Is there this many cameras in class every day?” Bloomberg asked a class of fourth-graders, referring to the crowd of media in a classroom at the Talented and Gifted School for Young Scholars in East Harlem. “They’re here because you have done so well in school.”

The city’s school system is thriving on many fronts: graduation rates are up, dropout rates are down, school crime continues to decline, and there are more schools and schools seats than ever before.

Bloomberg and school officials faced tough questions this summer when low scores for the third- through eighth-grade tests were released. The tests were based on the new and more rigorous Common Core Standards, different from prior tests.

Bloomberg said at the time that the scores would set a new baseline for teachers and students. Critics of high-stakes testing argue that it has been proven ineffective.

“They put together a test knowing that 70 percent of the kids will fail. It was failure by design,” Diane Ravitch, education historian and research professor of education at New York University, said during a recent talk referring to the Common Core tests.

Answering the questions of Hillary Zeng, a sixth-grader, Bloomberg said that based on conversations with students, teachers, and parents, the Common Core “is the kind of thing that is more germane to the world we’re going to live in, where you have to know more things, to be able to do more things, and stretch your mind.”

Hillary listened to the mayor and smiled while recording him on an iPad.