Police said they received a call about the shooting in the Vladislav Ribnikar primary school around 8:40 a.m.
Local media footage from the scene showed commotion outside the school as police removed the suspect, whose head was covered as officers led him to a car parked in the street.
Mass shootings in Serbia and in the wider Balkan region are extremely rare and none has been reported in schools in recent years. In the last mass shooting, a Balkan war veteran in 2013 killed 13 people in a central Serbian village.
Experts, however, have repeatedly warned of the number of weapons left over in the country after the wars of the 1990s. They also note that decades-long instability stemming from the conflicts as well as the ongoing economic hardship could trigger such outbursts.
Milan Milosevic, who said his daughter was in a history class when the shooting took place, told N1 television that he rushed out when he heard what had happened.
“I asked where is my child but no one could tell me anything at first,” he said. “Then she called and we found out she was out.”
“He (the shooter) fired first at the teacher and then the children who ducked under the desks,” Milosevic quoted his daughter as saying. “She said he was a quiet boy and a good student.”
Police sealed off the blocks around the school, in the center of Belgrade. Primary schools in Serbia have eight grades.