Michael Allen and Marc Levine will compete in an all-Democrat runoff for the 10th Assembly seat in November.
The pair were the leaders throughout the Tuesday night ballot count in the race for the newly created district representing Marin County and parts of Sonoma County.
Of seven candidates Allen received 30.3 percent followed by Levine with 24.2 percent.
In third, with 21.4 percent of the vote, was Peter Mancus, the sole Republican in the race. He is a Sebastopol attorney and gun advocate.
The top two candidates, regardless of party, face a runoff in the general election in November.
Trailing were Connie Wong with 11.2 percent of the total, Alex Easton-Brown with 6.4 percent, Joe Boswell with 4.4 percent and H. Christian Gunderson with 2.2 percent.
Allen's front-runner status confirmed political observers' predictions he would be the candidate to beat.
He currently represents the 7th Assembly district, which was redrawn during redistricting. He rented an apartment in San Rafael to establish residency within the new 10th District.
Levine is a first-term San Rafael city councilman.
"It's worth remembering that when we started, no one gave us a chance," Levine said.
Allen said he will focus on education and the environment in the fall campaign.
Voters "want real leadership in Sacramento, someone who has the skills and experience to get things done," he said.
Allen outspent Levine about 5-to-1 in the primary, with much of his financial backing from labor unions and the state Democratic party. Several independent committees also campaigned for him.
Levine's contributors came mostly from the San Rafael area, where he lives and has served on the City Council since 2009.