More than a million city kids groggily pivoted from the beach back to books Thursday, as the nation’s largest school system roared to life.

Mayor Bill de Blasio and Schools Chancellor Richard Carranza marked the occasion with a festive ribbon cutting ceremony at a new 3-K early education school in Staten Island.

Gripping their parents’ hands, the Department of Education’s youngest students excitedly filed into the new facility and were greeted by a pianist playing a medley of familiar hits.

As parents shook hands with de Blasio and Carranza, the children sang along and swayed to the melodies before detaching from their moms and dads and shuffling off to class.

“First day of school is one of the most magical days of the year,” de Blasio said. “For anyone who cares about kids — for our educators, for our parents, families — first day of school is amazing. It’s is a day of renewal and endless possibilities.”

De Blasio later touted an expansion of early education programs under his leadership and said 3-K programs were now present in every borough.

“We know that early childhood education works,” he said. “We know if makes a huge difference for a child. It makes a huge difference for a family. It makes a huge difference for the parents to then pursue their dreams as well.”

Parent Keshla Davila thanked de Blasio for establishing the program, telling the mayor that the 3-K program afforded her time to elevate herself while her son learned in school.

“3-K has helped me a lot,” she said. “Because I know he will be given free care with the education that he needs.”

The mayor also pointed to improved system-wide metrics — from graduation rates to AP course offerings — as evidence of progress.

The city hopes to have 20,000 kids enrolled in the 3-K program in the coming weeks.

De Blasio and Carranza were slated to visit schools in all five boroughs Thursday on the first day of classes.

Unlike prior years, no charter schools were the visitation schedule.