The marquee matchup of NYC’s seven congressional primaries was always touted to be the 13th Congressional District, where voters would replace longtime Rep. Charles Rangel. It didn’t disappoint.

State Sen. Adriano Espaillat declared victory, though fewer than 1,000 votes separated him and Assemb. Keith Wright, who had not conceded.

The race was full of old political, racial and ethnic rivalries that exploded into the open over the weekend, with Wright and supporter Rev. Al Sharpton alleging a plot to suppress the African-American vote, referring to a memo from an Espaillat-backing super PAC, according to published accounts.

Sharpton also bemoaned the candidacy of Clyde Williams, the Washington insider who ran a bold outsider campaign in NYC, for taking away from Wright’s support among black voters. It’s possible Williams did just that, his more than 10 percent of the vote helping to spoil the race for Wright.

Wright seemed to have everything going for him, from the coveted Rangel endorsement to the backing of the party machinery. But in the end, Espaillat made good on his third attempt for the seat, threading the needle in a crowded field.

The changing district, a storied center of African-American history and power, expanded to include a portion of the Bronx in 2012 and has become majority Hispanic. Espaillat ran twice against a weakened Rangel, censured for ethics violations in 2010, losing in 2014 by some 2,000 votes.

Espaillat will be heavily favored in the general election come fall. The candidate who came to America from the Dominican Republic without legal permission will likely be heading to Washington.

It’s a historic victory, and a confirmation of a changing district, but the tight race shows that the senator will have his work cut out for him putting together the district’s different factions. It’s a fitting ending to a race in which turnout and possible suppression was high on candidates’ minds, that the votes were so bitterly contested.

Everyone should be counted, as both Espaillat and Wright declared late Tuesday. Sadly, fewer voters cast ballots than in the district’s last primary, which featured Rangel, the marquee incumbent. But those that did took the first step toward finding a new Lion, of Inwood and the Bronx, in addition to Harlem.

Mark Chiusano writes the daily amExpress newsletter and is a member of the amNewYork editorial board.