COLUMBIA, S.C.—Hillary Clinton and Bernie Sanders spent Martin Luther King Jr. Day courting African-American voters in South Carolina, laying the groundwork for next month’s consequential primary in the tightening Democratic presidential campaign.

With the party’s two leading candidates running nearly even in the first two contests in Iowa and New Hampshire, both Mr. Sanders and Mrs. Clinton are looking ahead to South Carolina, the first vote to feature a large bloc of African-Americans, who hold significant sway in the Democratic...