Reflecting a changed electorate, a 33-year-old Taiwan-born political staffer won a six-way Democratic primary for Sheldon Silver’s old Assembly district, in the most competitive state legislative race Tuesday.

Silver had represented Manhattan’s Lower East Side since 1976, but was expelled from the chamber upon being convicted of eight corruption charges in 2015.

Yuh-Line Niou, a former Assembly staffer, garnered 31 percent of the vote, which was more than enough to defeat her nearest rival, Jennifer Rajkumar, who tallied 19 percent. Alice Cancel, a former Silver aide who had won a low-turnout, special election in April to finish the rest of Silver’s term, finished fourth , according to the state Board of Elections.

Niou’s contest was one of a few legislative primaries for New York City-based seats, in which winning the Democratic primary is tantamount to taking the general election in November.

Among the other key races, Marisol Alcantara, a union organizer, won a four-way battle to replace state Sen. Adriano Espaillat (D-Washington Heights), who stepped down to run for Congress.

Alcantara, who had Espaillat’s backing, defeated former city councilman Robert Jackson, former attorney general staffer Micah Lasher and community activist Luis Tejada.

advertisement | advertise on newsday

Alcantara was the lone candidate who pledged not to sit with the mainline Democrats in the Senate, but with a five-person breakaway pack (Indepedent Democratic Conference) that has shared power with Republicans.

Queens produced the one shocking upset of the night: Brian Barnwell, a 30-year-old attorney, defeated nine-term incumbent Assemb. Margaret Markey (D-Queens), 65 percent to 34 percent. Qns.com reported that Markey “took flack” recently for not showing up at a hearing about a controversial proposed homeless shelter in Maspeth.

Silver not only represented his district since 1977, he also served as speaker of the Assembly for just over 20 years — the second-longest tenure in state history.

Silver was convicted of essentially using his powerful position to collect some $4 million in bribes disguised as legal referral fees. He automatically lost his seat upon conviction, even though he is appealing the verdict.

In tune with the diversity of the Lower East Side district, the candidates include three born in Asia (Niou, Gigi Li and Don Lee), one daughter of Indian immigrants (Rajkumar), one who moved to New York from Puerto Rico (Cancel) and Paul Newell, a local Democratic leader who unsuccessfully challenged Silver in 2008.