Just after midnight, with 98.58 percent of precincts reporting, Cabán held a lead of 1.27 percentage points, or 1,090 votes, over Queens Borough President Melinda Katz in the six-way race. The Associated Press said the race was too close to call.
"When we started this thing, they said I was too young. They said I didn't look like a district attorney," Cabán told a jubilant crowd of supporters. "They said we could not build a movement from the grassroots. They said we could not win. But we did it, y'all."
But Katz had a different message for her supporters.
"We are doing a recount," Katz said, according to the New York Daily News.
Rory Lancman, who dropped out of the race last week and endorsed Katz, still received 1,168 votes -- less than the difference between Katz and Cabán.
The race was vaulted to national prominence last week, when Cabán announced the endorsements of Bernie Sanders, I-Vt. and Elizabeth Warren, D-Mass., liberal icons who are also rivals in the 2020 race. Ocasio-Cortez threw her support behind Cabán in May and on Sunday she headlined a rally for Cabán in Queens.
The primary comes almost a year after Ocasio-Cortez blindsided the political world in a stunningdefeat of Democratic heavyweight Joe Crowley, the longtime congressman seen as a potential successor to now-House Speaker Nancy Pelosi.
Katz drew support from the same broad coalition as Crowley.
If Cabán wins, she would become the youngest and by far the most progressive New York district attorney in memory.
"This race is going to have an immediate and profound effect on the lives of the 2.3 million people in Queens, but I also do see it as having a big national impact," Cabán told ABC News in an interview last week. "There's a real opportunity to be a model for what criminal justice reform looks like, especially in larger urban areas."
The population of Queens is more than 15 U.S. states (New Mexico, Nebraska, West Virginia, Idaho, Hawaii, New Hampshire, Maine, Montana, Rhode Island, Delaware, South Dakota, North Dakota, Alaska, Vermont and Wyoming).
Cabán was hailed by Warren and Ocasio-Cortez after her apparent victory Tuesday night.
"Tiffany Cabán took on virtually the entire political establishment and built a grassroots movement," Sanders wrote on Twitter. "This is a victory for working people everywhere who are fighting for real political change and demanding we end cash bail, mass incarceration and the failed war on drugs."
"I am so incredibly proud of @CabanForQueens -- and EVERY single person who showed up for this election today," Ocasio-Cortez, who represents part of Queens, said on Twitter. "No matter how this ends, you all have stunned NY politics tonight.
"When people come together, we can beat big money in elections. People power is no fluke."
Brown presented himself as a “law and order” prosecutor, and he presided over a historic drop in crime during his time in office. But critics say that his methods fueled the mass incarceration of minority New Yorkers and wreaked havoc in Queens' poorest neighborhoods.
Cabán introduced herself to voters as a "queer, Latina career public defender," and vowed to be a "decarceral" prosecutor -- reversing large-scale incarceration. She offered a long list of offenses that her office would decline to prosecute, including subway fare evasion, marijuana possession, sex work and resisting arrest when there is no other underlying crime.
Katz campaigned as the more moderate choice, casting herself as both a reformer and a steady hand with deep ties across the borough.