Final unofficial results gave Casten nearly 30 percent of the Democratic vote to 26.5 percent for Mazeski. Casten, a Dartmouth-educated engineer from Downers Grove, will face Republican incumbent Peter Roskam in the Sixth Congressional District race in November.
Results were delayed as the DuPage County Election Commission was affected by technical problems.
Mazeski, a breast cancer survivor who ran on a platform of expanded health care, held a narrow but steady lead over six other candidates through much of Tuesday night.
The district is considered ripe for a Democratic takeover after Hillary Clinton carried it over President Donald Trump two years ago.