A 19-year-old man armed with an assault-style rifle opened fire inside a synagogue near San Diego on Saturday, killing one woman inside and wounding three others in a "hate crime" on the last day of Passover.

The suspect John Earnest fled in a car and called 911 shortly afterward to say he was involved in the shooting at Chabad of Poway, San Diego Police Chief David Nisleit said.

When an officer reached him on a roadway, "the suspect pulled over, jumped out of his car with his hands up and was immediately taken into custody," Mr Nisleit said. The officer found an AR-type rifle in the front passenger seat.

Poway Mayor Steve Vaus characterised the shooting as a "hate crime," saying his assessment was based on statements uttered by the gunman when he entered the synagogue.

US President Donald Trump said the country stood in solidarity with the Jewish community after the attack, which came exactly six months since a shooting at a Pittsburgh synagogue killed 11 people in the deadliest attack on Jews in US history..

"Tonight, America's heart is with the victims of the horrific synagogue shooting in California, just happened," he told supporters at a rally in Wisconsin.