SACRAMENTO—A state Assembly committee voted along party lines Tuesday to recommend that Democratic U.S. Rep. Xavier Becerra be confirmed as California’s 33rd attorney general.

The 6-3 vote followed a friendly, two-hour hearing in which the 12-term congressman from Los Angeles took measured jabs at President-elect Donald Trump and his proposals on immigration, health care and the environment.