New York City students showed slight gains over the past year in reading and math test scores, according to testing data released Tuesday by the state Education Department.

Among the city’s third through eighth graders — 40.6 percent passed the state’s standardized reading exams this year, compared to 38 percent last year. The proportion of city students who passed the state math exams increased to 37.8 percent in 2017, compared with 36.4 percent in 2016.

The city’s boost in testing scores comes amid similar increases across the state — 40.2 percent of New York students passed their math exams, an uptick from 39.1 percent in 2016. And 39.8 percent of pupils were proficient in reading, compared to 37.9 percent in 2016.

New York City Mayor Bill de Blasio, joined by Schools Chancellor Carmen Fariña, lauded the improvements at a news conference in Manhattan. They noted that for the second year in a row the city’s students have “outperformed the rest of New York” in reading scores.

“We’re just at the beginning of an ascent . . . we’re going to go a lot further with our schools,” de Blasio said.

advertisement | advertise on newsday

Even so, de Blasio acknowledged his administration would examine shuttering or merging several underperforming schools that have long struggled with getting students to meet state education standards.

“It’s about looking deeper at every single school on the list,” said Fariña, referring to the list of 57 troubled schools that are part of the Renewal School Program launched by de Blasio in 2014. The program aims to reform underperforming schools.

Four percent of city students — 17,234 pupils — opted out of taking either the math or reading exams. Statewide, 19 percent of students opted out of the exams, a 2 percentage point-decrease from 2016, according to state data.