NEW YORK — 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.

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 as a center of black 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.