The children were taken to two separate hospitals on buses for medical evaluation. Rescue workers requested the special buses from Wiener Linien, who quickly responded to the emergency.
Shortly after 10 am on Thursday morning, an unknown person apparently released a large cloud of pepper spray in the basement of the New Middle School.
At least 17 children, aged between 10 and 14 years, complained of coughing, nausea, headache and throat irritation.
A spokesman for the Vienna Rescue Service, Andreas Huber, said that the behavior of the school was "exemplary."
The school's management had begun the evacuation of the building before the emergency services arrived.
The building was then aired out and later deemed safe for entry by emergency services.
Police have commenced an investigation into the incident.