Boston City Councilor Lydia Edwards won a hard-fought Democratic primary Tuesday, defeating Revere School Committee member Anthony D’Ambrosio in a closely watched special election. The result all but ensures that Edwards will be the next state senator for the First Suffolk and Middlesex District.

Although unofficial returns showed D’Ambrosio defeating Edwards in his hometown of Revere, it wasn’t enough to overcome Edwards’ margin in other parts of the district, which also includes Winthrop, several Boston neighborhoods, and part of Cambridge.

With no Republican currently on the ballot, the Jan. 11 general election is unlikely to prevent Edwards from filling the seat formerly held by Joe Boncore, who left the Legislature to lead the Massachusetts Biotechnology Council.

Assuming nothing interferes with a January victory, Edwards will be the only Black woman in the Massachusetts Senate.

"We had an intense ground game, and we stayed focused on the issues," Edwards told GBH News. "We never stopped working. We've been knocking doors consistently since August."

"What I've been consistent about is talking about how as a senator, you can take a regional approach, which is necessary to deal with housing, to deal with transportation, to deal with environmental justice, to deal with education ... dealing with the opioid crisis, there is no one city or town that can do it alone," Edwards added.

The primary contest was a case study in divergent Democratic identities. Edwards ran as a progressive change agent who promised to partner with Boston Mayor Michelle Wu, her close friend, at the State House. Edwards was strongly backed by Massachusetts’ progressive political establishment, including Wu, U.S. Senators Elizabeth Warren and Ed Markey, and Congresswoman Ayanna Pressley.

D’Ambrosio, in contrast, cast himself as an independent voice who was free of entangling ties and would aggressively take on “special interests” on Beacon Hill. He enjoyed overwhelming support from Revere’s political firmament, including Mayor Brian Arrigo and the city’s teachers’ and firefighters’ unions.

After conceding, D’Ambrosio praised his opponent.

“Senator-elect Edwards is a really smart person, and I think she’s going to do really great things in leadership in this district,” D’Ambrosio told GBH News. “I told her straight up on the phone … I’ll be rooting for her really hard, and I hope that my base does as well. That’s certainly what I’m asking folks to do."

“We live in scary times in the world and country and state right now, and we need something to believe in,” he added. “And I really hope she can be that person. I think she will.”

Edwards ran for the First Suffolk and Middlesex seat in 2016, when Boncore ultimately prevailed, and was later elected to represent District 1 — which includes East Boston, the North End, and Charlestown — on the Boston City Council. She graduated from high school in Michigan and attended college in New York, at Marymount College of Fordham University, and law school in Washington, D.C., at American University’s Washington College of Law.