But Los Angeles County Superior Court Judge Richard Naranjo added that the teen could be paroled early if California Youth Authority officials decide it is appropriate.
The boy, whose name was not released because he is a minor, was found guilty of second-degree murder earlier this month in a case heard in Lancaster Juvenile Court in northern Los Angeles County.
The victim, 15-year-old Jeremy Rourke, was struck on the knee and again on the head after an April 12 baseball game. He died later that night.
"The laughter in our house is gone," said Rourke's mother, Angela. "Not a day goes by that we don't cry."
The 13-year-old, who was a pitcher in the game, testified during the trial that he felt threatened by the much bigger teen. He said Jeremy pushed him and used a racial slur as the two waited in line at the concession stand in Palmdale, about 40 miles northeast of Los Angeles.
"I pray to God it never happens again," the judge said in issuing Thursday's ruling. "Jeremy Rourke didn't deserve to die for teasing."
Defense attorney William McKinney planned to appeal the decision and said he believed the boy would be paroled.
"He will have to live with that terrible mistake the rest of his life," he said.
Authorities said the judge's decision fit the crime.
"It's a tragic situation for all the families," said Jane Robison, spokeswoman for the district attorney's office. "There are no winners in this."
McKinney had argued that his client was acting in self-defense. The defendant is black and Jeremy was white, but McKinney said he did not believe the incident was racially motivated.
"I thought he was going to beat me up," the tearful defendant had testified. "I was scared."
During a three-day hearing, the defendant's teammates supported his story and said Jeremy was a known bully and had a history of confrontations at Pony League games.