ALBUQUERQUE, N.M.—Republican Gov. Susana Martinez's appointees to the New Mexico Supreme Court and the state Court of Appeals were defeated Tuesday by a pair of district court judges.

Democrat Barbara Vigil, of Santa Fe, beat out Justice Paul Kennedy for a seat on the state's highest court with 54 percent of the vote.

Vigil becomes one of just a few women to ever be elected to the court. She will share the bench with Petra Jimenez Maes, who was appointed chief justice earlier this year.

Vigil had served as a state district judge since being appointed in 2000 by Republican Gov. Gary Johnson. For a decade, she was responsible for cases involving juveniles, child abuse and neglect.

Kennedy, a former federal public defender, was appointed to the court by Martinez in September.

In the Court of Appeals race, Democrat Monica Zamora, a district judge in Albuquerque, defeated Judge Miles Hanisee with 55 percent of the vote. Hanisee, a former federal prosecutor, was appointed to the appellate court by Martinez last year.

Zamora became a judge in the children's court division of the 2nd Judicial District in 2005. A graduate of the University of New Mexico's law school, she had also worked as an attorney for 25 years.

At stake was whether the Republican governor would have an opportunity to leave a mark on the state's highest courts, which resolve appeals and set legal precedents.

The odds were stacked against Martinez's appointees, given that Republicans historically have had a difficult time winning in a state where Democrats outnumber GOP voters.

Only three Republicans have been elected to the Court of Appeals and none to the Supreme Court since the state adopted its current system of selecting judges. In fact, no Republican has won election to the Supreme Court since 1980.

In New Mexico, the governor appoints judges from candidates recommended by a bipartisan nominating commission made up of judges, lawyers and members of the public. Judges then run in a partisan election if they want to keep their job. If they win, they face periodic nonpartisan elections in which voters decide whether to retain or reject them.