Jose Iniguez, 8, was shot once in the chest Thursday afternoon while his mother slept and his father worked, said Nelida Stone, a San Joaquin sheriff's deputy.
The name of the boy who fired the shot was not released because of his age.
Stone said the boy told investigators he and his brother had been playing "WinBack: Covert Operation," a game rated for teen-agers in which the hero has to overpower terrorists to win back a weapons complex.
The boys began to act out roles in the game when Jose said he "wanted to get more real and got papa's gun," the older boy told investigators.
The younger boy got the loaded .25-caliber semiautomatic handgun from a box on top of a bookshelf. There was no ammunition clip in the gun, but apparently a round was in the chamber.
The older boy said he took the gun from his brother because it was dangerous. He said he accidentally pulled the trigger.
"They were playing at the time," Stone said. "It wasn't like they were fighting. It was a tragic accident."
The shot awoke the boy's mother, Esperanza Iniguez, 37, who found her youngest son lying on the floor covered in blood.
She phoned for help "yelling and screaming desperately that someone had been shot," Stone said. She and her older son tried in vain to perform CPR, though they didn't know the technique.
The boy originally told deputies his brother had shot himself. He later admitted pulling the trigger, Stone said.
He was not arrested and will probably not face charges. Stone said his parents will likely be prosecuted for not securing a loaded weapon.
The father, Jesse Iniguez, 40, said he owned the gun because he once worked as a security guard.