California Attorney General Xavier Becerra will face a retired Republican judge in his bid to keep the job he was appointed to last year.
The Democrat had about 45 percent of votes Tuesday and retired former Judge Steven Bailey had about 26 percent with nearly 3 million votes counted in the four-way race.
GOP attorney Eric Early and Insurance Commissioner Dave Jones, a Democrat, trailed behind.
Becerra, a longtime congressman, was appointed last year to replace Kamala Harris when she was elected to the U.S. Senate.
Becerra has relentlessly challenged President Trump on policies he said harm Californians. His challengers say Becerra has neglected other important issues because of his fixation with Trump.
Bailey is facing sanctions from the state's judicial watchdog for several alleged improprieties.
Copyright 2018 Capital Public Radio