Gubernatorial candidate Cynthia Nixon exchanged endorsements Monday with another insurgent trying to topple a long-term incumbent.

Nixon backed 27-year-old newcomer Julia Salazar over eight-term Brooklyn state Sen. Martin Dilan, and Salazar returned the favor by backing the former “Sex and the City” star at a press conference in Bushwick.

Last week, Nixon announced her support for Alexandria Ocasio-Cortez a day before the self-described socialist shocked the political world by trouncing veteran Rep. Joe Crowley, also the Queens Democratic Party chairman.

Nixon is clearly aligning herself with other challengers — particularly female candidates — to mobilize lefty voters in a bid to take down two-term incumbent Gov. Andrew Cuomo.

“We are both insurgents. We are taking on the status quo. We are taking on the centrist corporate Democrats,” Nixon said. “Julia is the future of the Democratic party.”

Dilan won in 2016 after defeating socialist tenant organizer Debbie Medina in that year’s Democratic primary, 55 to 38 percent. The 18th senatorial district takes in Bushwick, Williamsburg, Greenpoint, Cypress Hills, City-Line, East New York, Bedford-Stuyvesant and Brownsville.

“We’re developing each other and our communities to rise and replace the leaders who failed us,” said Salazar.

She said she can build on Medina’s showing against Dilan.

“This year, we’re planning to organize not only those voters but other progressives who are motivated to go to the polls because of Cynthia Nixon being on the ballot and also because they’re determined to finally replace Dilan with a progressive,” she said.