Former District Attorney Matt Sandoval unseated District Judge Gerald Baca in the Democratic primary Tuesday.
Sandoval took 4,475 votes, or 52 percent, of the vote in the Fourth Judicial District, which consists of San Miguel, Mora and Guadalupe counties.
Sandoval won in both San Miguel and Mora counties, while Baca took 56 percent in Guadalupe County.
No Republican ran in the heavily Democratic district, so Sandoval will run unopposed in the November general election. He takes office Jan. 1.