NEWARK — Senator Cory Booker of New Jersey, the former mayor of Newark who has projected an upbeat political presence at a deeply polarized time, entered the 2020 race for president on Friday, embarking on a campaign to become the nation’s second black president in a Democratic primary field that is the most diverse in American history.

Mr. Booker announced his candidacy on the first day of Black History Month to the sound of snare drums and with a clarion call for unity. In an email to supporters, he drew on the spirit of the civil rights movement as he laid out his vision for a country that will “channel our common pain back into our common purpose.”

“The history of our nation is defined by collective action; by interwoven destinies of slaves and abolitionists; of those born here and those who chose America as home; of those who took up arms to defend our country, and those who linked arms to challenge and change it,” Mr. Booker said in an accompanying video.

The field reflects a party in which women and candidates of color have injected a surge of new energy, and given urgency to the Democrats’ imperative of ousting President Trump. And it follows midterm elections in which women and minority candidates for Congress won in record numbers and have assumed some key positions in party ranks.

“It shows the growth of the country and that many of us who have struggled for civil and human rights feel that we are in a new moment that we wanted,’’ the Rev. Al Sharpton said in an interview. He added: “It’s like the new America against the old America and a lot of Americans who are older and younger want to make sure they participate in the new America.”

With Ms. Harris announcing her candidacy last month, Mr. Booker’s entry amounts to a presidential first: offering black voters, who have been crucial in determining the last two Democratic nominees, a choice between two black candidates as well as other contenders.

In an interview on SiriusXM’s Joe Madison show, Mr. Booker touted “the coalitions that we need to build in this country,’’ adding “we’ve got to begin to see each other with a far more courageous empathy to understand that we have one destiny in America.”

[Check out the Democratic field with our candidate tracker.]

Mr. Booker’s announcement had long been anticipated. He was among the most conspicuous campaigners for other Democrats during the 2018 midterm election, making 39 trips to 24 states as he honed a central message — that this was a “moral moment in America” — that is likely to frame his future critiques of the Trump administration.

Through his soaring oratory, laced with inspirational quotes, Mr. Booker has projected a relentless optimism that provides perhaps the starkest contrast to the divisive politics ushered in by Mr. Trump. His message of unity also comes amid a fractured Democratic coalition, where far-left progressives like Representative Alexandria Ocasio-Cortez view traditional Democrats with caution.

It remains to be seen whether Mr. Booker’s aspirational tones will fall flat with a Democratic electorate energized by seething anger toward Mr. Trump. Mr. Booker has at times been a harsh critic of the president, denouncing Mr. Trump’s degradation of African and Haitian countries as “the most vile and vulgar language.” He may face pressure to adopt a harsher, more confrontational message in his campaign.

Mr. Trump, in an interview with CBS’s “Face the Nation” that will air this weekend, cast doubt on Mr. Booker’s candidacy.

“He’s got no chance,” the president said. When asked why, Mr. Trump replied: “Because I know him. I don’t think he has a chance.”

Mr. Booker also has a lengthy record of moderate, pro-business stances that could be problematic for the party’s ascendant progressive wing.

For example, he defended the investment firm Bain Capital against attacks from the Obama campaign during the 2012 presidential election, and he had a chummy relationship with Chris Christie, the Republican former governor of New Jersey, for most of his tenure.

His continued embrace of charter schools, long a favorite of wealthy donors but currently out of favor among the Democratic grass roots, could create still more problems.

“My record as a mayor, my record as a senator is fighting those interests that are trying to screw people,” Mr. Booker said. “And when it comes to defending folk, I will be ferocious.”

In announcing his bid for president, Mr. Booker is seeking to fulfill the promise that many have seen in his future for two decades, ever since he moved from Yale Law School to the blighted Brick Towers of Newark, the symbolic launching pad for his career as an inner-city politician.

His first electoral victory was for the City Council in Newark, ousting an incumbent Democrat. He failed in his first bid for mayor, in 2002, against another entrenched Democrat, Sharpe James. But the loss made Mr. Booker famous as he raised millions of dollars in a race that drew national attention.

A documentary about his failed run, “Street Fight,” was nominated for an Oscar. Mr. Booker won the mayoralty four years later when Mr. James, who would eventually land in federal prison on charges of fraud, opted against a rematch.

As mayor, Mr. Booker crafted celebrity status through his early adoption of Twitter. He drew attention and money to the struggling city, including a $100 million check from Mark Zuckerberg, the founder of Facebook, to be injected into Newark’s schools. The gift was announced with much fanfare on “The Oprah Winfrey Show,” but brought mixed results to the troubled school system.

After running on a platform of making Newark a safer place to live, crime fell early in his tenure, but began to rise after budget cuts led Mr. Booker to lay off about 10 percent of the police force. At the same time, Mr. Booker’s police director embraced the controversial “stop-and-frisk” policy, and the American Civil Liberties Union accused the department of brutality, baseless searches, intimidation and false arrests. The Department of Justice launched an investigation into the department, though it was billed as “cooperative” and Mr. Booker said he “welcomed” the inquiry.