WASHINGTON – Far-reaching legislation that grants a chance at citizenship to millions of immigrants living illegally in the United States cleared the Senate Judiciary Committee on a solid bipartisan vote Tuesday night after supporters somberly sidestepped a controversy over the rights of gay spouses.

The 13-5 vote cleared the way for an epic showdown on the Senate floor on legislation that is one of President Obama’s top domestic priorities — yet also gives the Republican Party a chance to recast itself as more appealing to minorities.

The action sparked rejoicing from immigration activists who crowded into a Senate committee room to witness the proceedings.

In addition to creating a pathway to citizenship for 11.5 million immigrants, the legislation creates a new program for low-skilled foreign labor and would permit highly skilled workers into the country at far higher levels than is currently the case.

At the same time, it requires the government to take costly new steps to guard against future illegal immigration.

There was suspense to the end of the committee’s deliberations, when Sen. Patrick Leahy, the Vermont Democrat who serves as chairman, sparked a debate over his proposal to give same-sex and heterosexual spouses equal rights under immigration law.

Leahy was forced to back down by opposition from both sides, but the issue is likely to reappear as the bill progresses.