ALBANY – In a deal with implications for tax, spending and social agendas ranging from gun control to environmental matters, State Senate Republican leaders Tuesday brokered an arrangement with five Democrats to form an unusual coalition that preserves GOP dominance in the Senate for the next two years.

Though they did not win enough seats in November to run the Senate outright, the Republicans, in one day, managed to keep at least partial control of the 63-member chamber and create deep fissures in the state’s Democratic Party over the renegade Democrats.

The compact involves a complex power-sharing agreement in which the top Republican will trade the title of Senate leader every two weeks with the leader of the breakaway Democrats.

As a result, Republicans win a stronger voice for upstate in the Senate than would have been the case had the GOP lost control to the New York City-dominated main Democratic conference.

While business groups cheered the outcome, many left-of-center groups and lawmakers said the alliance will make it harder to get deals on a state minimum wage hike, changes to help localities cope with the property tax cap and efforts to drive more state aid to poorer school districts.

Though some may dismiss the doings as inside baseball, Tuesday’s deal will affect everything from distribution of school aid and infrastructure projects to what kind of taxes might be raised next year to close the deficit.

While Gov. Andrew M. Cuomo, who did not help his fellow Democrats try to retake the Senate, sought to stay above the fray, saying he will reserve judgment until he sees how the chamber is run next year, Democrats say the agreement would not have happened without at least a wink from the governor.

Indeed, while Senate Democrats officially characterized the deal as a “coup,” the governor’s hand-picked Democratic Party co-chairwoman, Syracuse Mayor Stephanie Miner, said in an interview Tuesday that she hopes the Senate coalition will create “a government that works.”

Insiders say Cuomo privately expressed happiness with the outcome.

The deal by the GOP and the five-member Independent Democratic Conference, led by Sen. Jeff Klein of the Bronx, appears to make moot a legal battle over a still-contested Senate race in a Mohawk and Hudson Valley district that Democrats believe they will win if all remaining 877 contested paper ballots are opened.

The deal is seen as a “Hail Mary” play by the Republicans, who suffered several stinging losses in last month’s election and already had to cut a deal with an incoming Brooklyn Democrat to cross party lines to caucus with them. The move came only hours after Sen. Malcolm Smith, a Queens Democrat and former Senate majority leader, announced he was joining the Democratic breakaway group.

Klein and Senate Majority Leader Dean Skelos, a Long Island Republican, called their deal “historic” and said it that will guarantee a “fiscally responsible, fully functional Senate.” As for titles, Skelos and Klein will be called conference leaders of their two groups and will “administer joint and equal authority” over what bills are heading to the Senate floor for votes, will have dual roles in negotiating the state budget with the Assembly and governor, and will share in decisions about appointments to state and local boards and commissions. The two also will share in leadership and committee assignment decisions.

Skelos and Klein, in a unusual move, will trade the title of temporary president – essentially, the head of the Senate – every two weeks.

The deal shows just how far the Republicans were willing to compromise in order to stay in power for another two years. It will be put in writing in new Senate rules when the Legislature returns in January for its 2013 session.

“This is not a coalition, but a coup against all New Yorkers who voted for Democratic control of the Senate and a progressive state government,” said Mike Murphy, a spokesman for the main Senate Democratic conference.

The uncertainty about the outcome of the lone contested Senate race put pressure on Republicans to cut a deal now with Klein and the breakaway Democrats – Diane Savino of Staten Island, David Carlucci of Rockland County, David Valesky of Madison County and Smith.

The power fight has its consequences. Democrats have insisted that what they call progressive legislation, such as new gun-control restrictions and public financing of campaigns, will not happen now that the Republicans remain partially in control.

For Cuomo, it means he will have in power a group with which he has already cut major deals during his first two years in office. For upstate, the fight was important. The GOP’s base of support is upstate and Long Island, while most Senate Democrats are from New York City. Republicans said that if the Democrats had taken control, upstate would have been ignored. Democrats called that claim absurd and said the GOP has been in charge of the Senate during decades of economic decline upstate.

“It preserves the balance in the state,” Sen. George Maziarz, a Newfane Republican, said of the New York City-led Assembly and the upstate and suburban-led Senate.