The pitched six-week battle for the Democratic nomination for Queens district attorney finally ended on Tuesday, when Tiffany Cabán, whose bid galvanized progressive activists nationwide and exposed deep rifts within the left, conceded to Melinda Katz, the favorite of the state party’s establishment.

The result was a vindication for the Queens Democratic Party, which was left reeling last year after the defeat of former Representative Joseph Crowley by Alexandria Ocasio-Cortez.

Party leaders, as well as powerful figures such as Gov. Andrew M. Cuomo, threw their full weight behind Ms. Katz, the Queens borough president, as she fended off Ms. Cabán, a democratic socialist who drew comparisons to — and an endorsement from — Ms. Ocasio-Cortez.