The angry teenager repeatedly punched Euan Craig at their school in Glasgow.
Euan, 14, slumped to the ground in front of classmates before he later died, having suffered a freak head injury.
His attacker, who cannot be named for legal reasons, pleaded guilty to culpable homicide at the High Court in Glasgow.
Euan's parents, Anne and Richard, were in court to hear the tragic events of May 23.
Prosecutor John Scullion told how the two third year pupils were attending separate PE classes.
Euan and his friends began playing with a sponge ball while waiting for their teacher to arrive. The killer entered the gym as Euan threw the ball at a friend.
But it missed the friend and struck the other boy on the side of the face.
Euan immediately apologised, but the court heard the attacker punched Euan about five times to the left side of the head, despite Euan continuing to apologise.
When the attacker stopped and left the gym, Euan went to sit beside other pupils, but suddenly slumped from the bench and started to suffer a seizure.
He was rushed to the Southern General Hospital, where a CT scan revealed he had extensive bleeding on the brain. Euan was pronounced dead the next afternoon.
A pathology report concluded the fatal haemorrhage was caused by Euan being hit on the left side of his face.
Ian Duguid, defending, said of the attacker: "He cannot remember acting in such a way before."
Lord Bracadale deferred sentence until November 23 and allowed bail, but warned the teenager: "You must return to court in the expectation a custodial sentence is the most likely outcome."