The German television channel N-TV said eight students and two adults were killed at the Albertville school in Winnenden as the result of the attack. Several other people were also injured.
The gunman, in his early 20s, was dressed in black combat fatigues and is believed to have fled the school. Some media reports said the attacker was a former pupil.
The school was evacuated after the incident, which occurred at around 9:45 a.m. local time (08:45 GMT).