Teachers and students at the school in Bang Rakam district appeared to panic and began shouting when a fire broke out at a Pathom 6 classroom on the second floor of the wooden building during the lunch break.
Kriengkrai Boonklieng, a Mathayom 2 (Grade 8) student, led three friends to grab a fire extinguisher and run into the room to attack the fire with spray from a chemical extinguisher to try to put out the fire, school director Thammanoon Saithong said.
The fire was contained 10 minutes later, and before district firefighters arrived to bring it under final control, he added.
The school director praised Kriengkrai for his prompt reaction, which alerted others to follow and help fight the fire.
Kriengkrai modestly credited the school for holding regular fire evacuation drills, including advice to give regular checks of all fire extinguishers at the school.
Pol Lt Col Ubon Kanthakhiew, an investigator at Ban Rakam police station, said the fire could have been caused by an electrical short circuit inside the room.
Mr Thammanoon said the school will request the provincial education office to finance installation of new wiring for all buildings at the school.