NEW YORK (CBSNewYork) – Public Advocate Letitia James has won a four-way Democratic primary for attorney general in New York. The race was a competition over who could best use the office to antagonize President Donald Trump.

READ MORE: 4 More Omicron Cases In New York State, Gov. Hochul Says

James would become the first black woman to hold statewide elected office in New York if she prevails in the general election.

In her victory speech Thursday night, James took aim at Trump, saying he “can’t go a day without dividing us” and telling her supporters they’re “in the middle of a fight to save our democracy.”

She says Trump “can’t go a day without threatening our fundamental rights,” or the rights of immigrants.

The 59-year-old was an early favorite in the race after getting endorsements from Gov. Andrew Cuomo and other top Democrats.

READ MORE: Wake Today For Probationary Firefighter Vincent Malveaux

But the race tightened over the summer. James edged U.S. Rep. Sean Patrick Maloney, law professor Zephyr Teachout and ex-Hillary Clinton adviser Leecia Eve.

James faces a little-known New York City attorney, Republican Keith Wofford, in November.

New York’s attorney general congratulated the four Democrats running in a primary to replace her and says she’s proud to have kept the office going after Eric Schneiderman‘s sudden resignation in May.

Barbara Underwood tweeted Thursday before polls closed that the candidates “believe in the power of this office” and have given voters “a choice for the future.”

Underwood says she hopes it’s clear the office “is the sum of all its staff. I am so proud to be your AG.”

MORE NEWS: Police: Burglar Steals From Brooklyn Synagogue 3 Times

(© Copyright 2018 CBS Broadcasting Inc. All Rights Reserved. The Associated Press contributed to this report.)