LOS ANGELES — Kamala Harris made history when she became the first black woman to be elected attorney general in California. Now she is vying for the United States Senate, and she has managed to stay the front-runner in the race ever since she announced last year, just days after Senator Barbara Boxer, a fellow Democrat, said she would leave the seat she won in 1992.

With the help of allies, Ms. Harris nudged aside other prominent Democratic contenders, including Antonio Villaraigosa, the former mayor of Los Angeles, and United States Representative Xavier Becerra.

But as Tuesday’s open primary for the seat approaches, Ms. Harris’s chief rival is from her own party — Loretta Sanchez, a congresswoman from Southern California. And their competition says as much about California as it does about the candidates.

In a state with one of the most diverse electorates in the nation, where Latinos are the largest ethnic group, a victory by either woman would be a milestone: Ms. Harris would be the first black woman in the United States Senate since Carol Moseley Braun, an Illinois Democrat who served from 1993 to 1999, and Ms. Sanchez would become the first Latina elected to the Senate.