An angry mob stormed the field during the amateur game in the state of Maranhao and stoned Otavio da Silva to death before severing his head.
Police said the murder was in retaliation for Mr Silva stabbing player Josenir dos Santos.
One man has been arrested over the killing and investigations continue.
The incident took place on 30 June in the remote town of Pio XII, but news of the event has been slow to emerge.
The state’s Public Safety Department said it started when the referee and Mr Santos got into fist fight after the player was sent off but refused to leave the pitch.
Mr Silva then pulled out a knife and wounded Mr Santos, who died on his way to the hospital.
The player’s friends and relatives rushed onto the field, stoned the referee to death and dismembered his body, the department said in a statement.
So far police have arrested a 27-year-old man in connection with the crime.
“We will identify and hold accountable all those involved,” police chief Valter Costa was quoted as saying by local media.
“One crime will never justify another.”