Rep. Charlie Rangel, a Democrat who has represented Harlem in Congress for more than four decades, celebrated victory over state Sen. Adriano Espaillat in a primary Tuesday -- but, after midnight, the race still had not been called, nor had Espaillat conceded.

With 99.6 percent of precincts reporting, Rangel led by fewer than 2,000 votes. That razor-thin margin left the race too close to call, but Rangel and his supporters celebrated anyway, with a drawn-out, meandering victory speech and balloons.

The zany twist drew out the conclusion to a hard-fought and, at times, rancorous rematch between Rangel and Espaillat.

The vote Tuesday echoed the outcome of that first match-up in 2012, when Espaillat lost narrowly to Rangel, by more than 1,000 votes. Espaillat has worked to further develop his political brand since then and has been optimistic that a second race would prove more successful.

Meanwhile, Rangel's political situation has not much improved since his last precarious win. He has been dogged in this election, as in 2012, by his 2010 censure, imposed by Congress for ethics violations. Rangel has devoted considerable campaign funds and time to fighting the punishment.

Harlem's demographics have also been shifting beneath Rangel's feet.

When Rangel won his first election in 1970, Harlem was a predominantly African-American neighborhood. But in recent years it has become less so, while the Hispanic population has ballooned. White residents who have also moved in were targeted as important swing voters in the congressional race.

Those new demographic realities have imbued Rangel's and Espaillat's rivalry, at intervals, with racial undertones -- so much so that Rev. Al Sharpton summoned the candidates to his office after a debate a few weeks ago to caution them against going too far.

But Rangel has perhaps been hampered most by his own recent history in Congress, marked by diminished power after his censure. The New York Times editorial board called it “humiliating” before endorsing Espaillat in the race.

Still, Rangel appeared to be holding on in some public polls in the final few weeks of the race.

The third-longest-serving current member of the House, Rangel was a founding member of the Congressional Black Caucus and served as its chairman for two years. Back in New York, Rangel helped fashion Harlem into a political powerhouse within the city, as one of a “Gang of Four” local political leaders.