Fifteen were injured when the suspect, named by police as Santino William Legan, 19, opened fire at the Gilroy Garlic Festival on Sunday evening.
Police say the suspect used an assault rifle that he purchased legally in neighbouring Nevada this month.
The gunman was shot dead by police, who are looking into a possible accomplice.
Six-year-old Stephen Romero is the first of the dead to be identified by local media. His mother and grandmother were wounded.
Police confirmed a man in his 20s was also killed. None of the victims have been officially named.
At least 15 people were transported to hospital, according to officials from the four hospitals where victims were brought. At least 12 were treated for gunshot wounds, according to health officials.