Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

WASHINGTON — A month ago, Ayanna Pressley told NBC News she was in “a fight for the soul of our party.” On Tuesday night, she won it.

In a stunning upset in John F. Kennedy’s old congressional district, Pressley, the first woman of color elected to Boston’s City Council, defeated Rep. Mike Capuano, D-Mass., a 10-term incumbent in a high-profile Democratic primary.

Polls had shown Capuano, who had never faced a serious challenge since being elected in 1998, with big leads. But Pressley defied the odds to not just win, but outpace Capuano so decisively that he conceded the race less than an hour and a half after polls closed.

She appears to have done it by turning out young people and people of color, neither of whom typically vote in party primaries. With more than 90 percent of precincts reporting, Pressley had 58.4 percent, or 50,917 votes, to Capuano's 41.6 percent, or 36,234 votes.

"Clearly the district wanted a lot of change,” Capuano told supporters.

Unlike Rep. Joe Crowley, D-N.Y., who was caught off-guard when he lost his primary this summer, Capuano recognized the threat early. And unlike Alexandria Ocasio-Cortez, who beat Crowley in her first run for office, Pressley has been a rising Democratic star for years.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

“Ayanna Pressley is going to be a good congresswoman, and I will tell you that Massachusetts will be well served,” Capuano said.

House Minority Leader Nancy Pelosi, who donated to Capuano's campaign, thanked him for his long service, before saying she looked forward to welcoming Pressley to the caucus. Her heavily Democratic district has no danger of falling into Republican hands.

Capuano had no whiff of scandal and has a nearly perfect progressive voting record. But he hails from an older, more parochial school of politics which Pressley said didn't cut it anymore in the Donald Trump era.

More importantly, Massachusetts’ 7th Congressional District is the only one in New England where racial minorities outnumber whites and Pressley argued she could better represent the Boston and Cambridge-area district than Capuano, who is white.

"It's not just good enough to see the Democrats back in power. It matters who those Democrats are," Pressley told her own supporters. "While our president is a racist, misogynistic, truly empathy-bankrupt man, the conditions which have made the 7th C.D. one of the most unequal in America were cemented through policies made long before he ever descended the escalator at Trump tower."

Pressley, too, took a moment to praise her opponent, recalling moments when they shared a bullhorn at local political rallies and demonstrations. "He forced me to bring my best, just like in this," she said.

While there was little ideological daylight between the candidates, it’s another victory for the insurgent left, which has seen its biggest successes with candidates of color who embrace progressive ideology, such as with Florida gubernatorial candidate Andrew Gillum and Ocasio-Cortez, who vocally supported Pressley.

Congratulations to my sister in service, @AyannaPressley, on continuing her historic path into Congress tonight.



Let’s push together to make Medicare for All, tuition free college, & living wages a reality in America - all without corporate PAC money. https://t.co/o2SbtUkByS — Alexandria Ocasio-Cortez (@Ocasio2018) September 5, 2018

"The winning strategy in the future of the Democratic Party points to exciting a broad, multiracial coalition of the grass roots — new voters, young voters and people of color," said Maria Urbina, the political director of the liberal group Indivisible.

Urbana said Indivisible has been pushing Democratic voters to get more involved in primaries, where individuals can often have a bigger impact, and Pressley's victory is proof of that strategy. "It’s just such a big deal for the entire movement," she said.

Jeffrey Brown, an associate pastor at the Twelfth Baptist Church in Roxbury, an African-American neighborhood in Boston, said residents there have dreamed of getting a person of color in the district. In fact, it was specifically redrawn to make that possibility more likely.

"They were taking up not only the hope of Pressley as a congresswoman, but the hope that this community will finally get some of their issues heard and addressed from someone who truly understands them," said Brown, who endorsed Pressley.

Pressley has spoken often about being raised by a single mother because her father was incarcerated or struggling with addiction, and her campaign focused on themes of racial, economic and geographic inequality.

Most elected Democrats in Massachusetts and Washington sided with Capuano. And Brown said he was disappointed to see the Congressional Black Caucus prioritize loyalty to a fellow incumbent over the possibility of growing their ranks.

"I don’t even know if she should join the Congressional Black Caucus. None of them supported her," he said.

Even those who did not endorse Pressley for political reasons have said nice things about her.

“I’m excited for her. I’m really feeling enormous sense of pride for what’s she’s accomplished,” former Massachusetts Sen. John Kerry said on MSNBC Tuesday night. “I’m happy for Massachusetts.”