Police say they responded to the incident at Viertola school before 09:00 (06:00 GMT) on Tuesday and urged local residents to remain indoors.
A suspect, who police say was also aged 12, has been arrested.
The school has 800 students and 90 staff. Witnesses told public broadcaster YLE that two ambulances had left the scene.
In common with other Finnish schools, children had just returned to classes in Vantaa, north of the capital Helsinki, after the long Easter weekend.
I wonder what will happen to the gun owner. They clearly did not secure their gun.