The incident occurred Friday morning at Middle School of the Kennebunks, the Portland Press Herald reported.
Judy Milligan, the girl's mother, said the 14-year-old was treated for second-degree burns at Southern Maine Medical Center in Biddeford.
"Immediately, smoke starts billowing from around the student," Jeff Rodman, the principal, said. "She knew right away something was wrong and, in a panic, knew her pants were on fire caused by the cellphone."
The girl had the presence of mind to "stop, drop and roll," causing the phone to fall out of her pocket and reducing her own injuries. But her pants were still burning.
Rodman said girls in the class helped the student get her pants off in a corner while getting the boys out of the room.
Milligan said her daughter wanted to return to school from the hospital but school officials advised her to take the rest of the day off. Milligan, who did not want her daughter's name in print, described her as "a calm person."