The incident happened at the private Colegio Cervantes school in the city of Torreón in Coahuila state.
It was not immediately clear what his motives were.
Though murders are on the rise in Mexico, school shootings are rare.
The boy – who has not been identified – was a good student who lived with his grandmother and had normal behaviour, Mayor Jorge Zermeño told Milenio TV.
He carried two guns, Mr Zermeño said. It was not clear how the boy had obtained them.
The shooting happened at about 09:00 local time (15:00 GMT) on Friday in Torreón, some 800km (500 miles) from the capital, Mexico City.
The mayor said police were still trying to locate his parents. Dozens of police and soldiers have surrounded the school.
The injured included five students and a physical education teacher. They are in stable conditions in hospital.
Coahuila state Governor Miguel Angel Riquelme said the boy had asked to go to the bathroom at the start of the school day.
His teacher went to look for him after 15 minutes, and the boy then emerged firing his weapons, Mr Riquelme said.
“He was well behaved, but he told some of his classmates that ‘today was the day’,” he said.
Mr Riquelme said the boy had worn a T-shirt bearing the name of the video game Natural Selection, partly a first-person shooter game.