City Police Chief Asep Edi Suheri said at a press conference that 54 people were hospitalized with minor to serious injuries, and some suffered burns.
Officials told reporters that the suspect is a 17-year-old student who is currently undergoing surgery.
Jakarta Metropolitan Police are investigating the suspect's background and a possible motive. The explosion occurred at around 12:15 pm local time (05:15 GMT) in the Kelapa Gading area of North Jakarta.
A bomb disposal team was sent to the government high school complex to collect evidence and ensure there were no other explosive devices.
Officials said three people were seriously injured and 17 others suffered minor injuries. According to local media reports, the remaining people were treated and discharged.
A student at the school told Indonesia's state news agency, Antara, that a student had brought a homemade bomb and that the student was often harassed by other students.
Other students told Indonesian news outlets that the suspect was a "loner" who often drew violent images, and was found lying on the ground after the blast.
A school cook reported that after a "loud" explosion, she saw white smoke billowing from the mosque and shattered windows.
She told"Our hearts were pounding, we couldn't breathe."
A senior Jakarta Metropolitan Police officer confirmed the presence of two firearm-like objects at the scene.
Antara photos show one object resembling a submachine gun and the other resembling a pistol.
The barrel of the submachine gun-like object reads: "14 words. For Agatha." Written on its body is: "Brenton Tarrant. Welcome to hell."
Brenton Tarrant is the perpetrator of the 2019 mass shooting at a mosque and Islamic center in Christchurch, New Zealand, which killed 51 people and injured dozens more. A minister who arrived at the scene later on Friday denied claims that weapons were present. He told that what was seen in the photo was "not a real gun, but a toy gun." Lodewijk Frederik Paulus also appealed to the public not to assume the blast was a "terrorist attack," as investigators were still examining the scene.
Another item found at the scene was a dark green belt used to store ammunition.
Indonesia has the world's largest Muslim population.