San Bernardino County sheriff's officials said the attack happened at the Adelanto Community Day School, a facility for at-risk kids.
The boy apparently became upset with his teacher because she asked him to move to another seat in class.
The teacher was taken to a nearby Mojave Desert hospital for treatment. The boy was taken to juvenile hall for investigation of assault.
The Associated Press contributed to this report.