U.S. Rep. Charles Rangel, the face of Harlem politics for generations, held off a strong Democratic primary challenge and moved one step closer to what he says will be his 23rd and final term in the House.

Rangel, 84, defeated state Sen. Adriano Espaillat in what was a bruising fight that shed light on the changing face of a district that was once one of the nation's black political power bases.

With 100 percent of the vote counted in unofficial results, Rangel led Espaillat 47.4 percent to 43.6 percent, a difference of fewer than 2,000 votes. Nearly 47,800 votes had been counted. The Associated Press called Rangel the winner based on information Wednesday from the city Board of Elections on ballots cast that were not included in the election night tally. The number of absentee and provisional ballots was not sufficient for Espaillat to make up the difference.

"Fired up and ready to go!" the congressman declared in a statement thanking voters for "standing with me to the very end and giving this veteran his one last fight."

"I've got a lot of fight in me and will not let them down," said Rangel. He added that he hoped to begin healing the "division that was created during the course of the campaign."

The election pitted Rangel, the "Lion of Harlem" who has long personified the area's role in as a center of African-American political culture, against Espaillat, 59, a veteran state lawmaker seeking to become the first person born in the Dominican Republic to be elected to Congress.

Espaillat, who lost to Rangel in 2012 by about 1,000 votes in results that took two weeks to finalize, has not conceded, urging that every vote be counted. The official count won't start until July 2, when the absentee and provisional ballots are opened, and Espaillat's team has said it could mount a legal challenge. His campaign declined to comment Wednesday.

For his part, Rangel took to the stage Tuesday night for nearly an hour of what he termed "sweating it out" with supporters -- his own off-the-cuff remarks, homages from prominent supporters including former Mayor David Dinkins and even a moment of danger when the stage buckled under the weight of all those gathered on it. After ascertaining that no one was injured, Rangel kept on talking.

Finally, after a local TV station called the race, balloons dropped from the ceiling, and Rangel told supporters: "This was your victory."

Rangel was once arguably the nation's most influential black elected official, known for speaking out global issues -- he strongly opposed apartheid and the Iraq War -- but also for programs closer to home. He pushed to create a low-income tax credit that fueled the nation's largest affordable housing program, as well as a business empowerment zone that changed the economic face of Harlem.

But he was weakened after 2010 ethics violations that forced him to give up the chairmanship of the powerful House Ways and Means Committee, and his heavily Democratic district was then redrawn. The new lines, along with gentrification and demographic shifts in Harlem, created a district with a Hispanic majority in what was once a black stronghold.

The shifting racial terrain was a backdrop for the race, which grew nastier as primary day approached. At a debate, Rangel said Espaillat "wants to be the Jackie Robinson of the Dominicans in the Congress," adding that Espaillat should tell voters "just what the heck has he done besides saying he's a Dominican."

That remark drew a sharp retort from Espaillat and a chiding from Mayor Bill de Blasio, who managed Rangel's 1994 campaign yet refused to offer an endorsement this time. De Blasio said Wednesday he'd reserve judgment on the race until the official count was concluded, but he congratulated Rangel on "a strong performance."

While the election reflected a changing constituency, political experts say other realities played an important part in the outcome.

"Incumbency is a key factor," especially in a June primary that brought out less than 14 percent of the district's registered Democrats, said Jeanne Zaino, a political science professor at Iona College and New York University. But generational change may also have played a role, as some voters -- increasingly, younger than Rangel -- look for new leadership even if they respect his contributions, she said.

Still, Rangel has seen his district through enormous transitions, and he's had nearly half a century of experience persuading voters that he should be a constant even amid the change, Fordham University political scientist Christina Greer noted.

"He's weathered all of the storms, and people still come out to support him," she said.

Harlem pastor the Rev. Michael Walrond and Bronx activist Yolanda Garcia also ran, finishing far back.