Mayor Bill de Blasio praised the newly elected speaker of the New York Assembly, Carl E. Heastie, as an “incredible” leader and an ally. Mr. Heastie promised that renewing and strengthening the rent-regulation laws that affect a million city apartments would be his “No. 1 priority.”

After a year in which City Hall battled rough waters in Albany, the two men’s first joint public appearance as mayor and speaker on Sunday afternoon was just about everything the mayor could have hoped for to start a relationship that would help determine the fate of his efforts to curb economic inequality. Strengthening rent-regulation laws, which are due to expire on June 15, are a critical component of the affordable-housing vision Mr. de Blasio, a Democrat, outlined in his State of the City address last week. But his plan is emerging at a politically precarious time in the capital.

Mr. Heastie, a Bronx Democrat, replaced Mr. de Blasio’s close ally in Albany, Sheldon Silver, as speaker after Mr. Silver was charged last month with corruption. And Mr. de Blasio did himself no favors in the Republican-controlled State Senate, which is traditionally sympathetic to landlords’ concerns, by trying to elect a Democratic majority last fall.

But when mayor and speaker met at the Ebbets Field Apartments, a 1,500-unit rent-stabilized complex in Crown Heights, Brooklyn, Mr. Heastie seemed ready to assume the role of tenant-rights champion.