Eight people have been killed in a school shooting in Brazil.

Four children were among the dead after two gunmen opened fire inside the school near Sao Paulo.

Around 15 others were injured in the shooting, which took place at the Raul Brasil public school in Suzano, on the outskirts of Sao Paulo in southeast Brazil.

The two gunmen also took their own lives, authorities said.

Military police Colonel Marcelo Sales said two assailants burst into the school grounds in the early morning, armed with a .38 caliber revolver and a "medieval weapon that looked like a bow and arrows".

After shooting at students in the yard, the attackers headed to the language centre where several pupils were hiding and "committed suicide in a corridor," Sales said.

"Eight people died at the scene, including the two assailants," a state military police spokesman said.

Sao Paulo State Governor Joao Doria said four children and two members of staff were among the dead.

He said it was not yet known whether the assailants were former pupils at the school.

The attack took place during a recess period for some students, authorities said.

Education Minister Ricardo Velez published a statement offering "solidarity with the parents, families and staff at the school in this moment of shock, mourning and pain."

It's not the first mass school shooting in Brazil's history.

In April 2011, a former pupil killed a dozen school children and injured many more before turning his gun on himself at a school in the suburbs of Rio de Janeiro.