LAS VEGAS — Democratic presidential candidate Hillary Clinton narrowly won the Nevada caucuses on Saturday, beating back a stronger-than-expected challenge from rival Bernie Sanders.

With 87 percent of precincts reporting, Clinton was leading with 52.6 percent of the vote to Sanders’ 47.4 percent. Vote counting was delayed in Nevada by heavy turnout.

“This is your win,” Clinton said in a tweet, thanking supporters for her victory.

Clinton’s narrow margin of victory in a state where she was once expected to win by double digits suggested the Democratic nominating race could be long and hard-fought, with Sanders performing strongly in a state with a heavy minority population.

Sanders was hoping to prove his appeal to minority voters in Nevada and puncture Clinton’s argument that he is a one-note candidate whose support is limited to mostly white states.

After routing Clinton in New Hampshire and finishing a strong second in Iowa — states with nearly all-white populations — Nevada gave Sanders his first chance to prove he can win over black and Hispanic voters and compete nationally as the race moves to states with more diverse populations.

Republicans in South Carolina also were voting on Saturday in the state-by-state contest to pick nominees for the Nov. 8 election, with opinion polls showing front-runner Donald Trump trying to solidify his spot at the top of the pack and rivals Ted Cruz and Marco Rubio fighting for a second-place finish.

Behind them, Republican candidates Jeb Bush, John Kasich and Ben Carson could be vying in South Carolina to keep their campaigns alive before the presidential race rapidly picks up steam in March when dozens of states hold nominating contests.