A field of 23 candidates was seeking the open U.S. House seat previously held by Democrat Xavier Becerra, who was appointed the state's attorney general.
Under California's balloting rules, if no single candidates exceeds 50 percent, a runoff is held between the top two vote-getters.
Gomez had more than a quarter of the overall vote and Ahn had just under a quarter in Tuesday's initial results, with no other candidate pulling in more than 8 percent.
The race featured 19 Democrats, one Republican, a Green Party candidate, one Libertarian, and one unaffiliated, plus one write-in candidate.
The 34th Congressional District includes Eagle Rock, Boyle Heights, downtown LA and Koreatown and has 305,000 registered voters.
Gomez, a state Assemblyman, was seen as a front-runner who had the backing of much of the state's Democratic establishment, including Becerra and Los Angeles Mayor Eric Garcetti. Those endorsements, he said, helped show voters his qualifications for the job.
"My message is that what you're seeing here is the emergence of a new progressive Democratic coalition that's based on ideas, that we're going to represent everybody," Gomez said.
Ahn, an attorney and city planning commissioner, had raised the most funds in the field and had strong support in LA's Korean community.
"The Korean-American community hasn't had a voice in Congress for over 20 years," Ahn said. "So this is a community that's been consistently underrepresented and now they're starting to find their voice."
The election was the nation's first congressional race since Donald Trump was elected president. Both candidates said they oppose the Republican president and would work hard to defeat his agenda.