The Maryland Senate, defeating a barrage of proposed restrictions on Citicorp's ability to open branches in the state, handed the giant New York bank and Gov. Harry Hughes a victory tonight that could seal their controversial agreement for creating hundreds of new jobs in the Hagerstown area.

"I'm very, very thankful," Citicorp spokesman Malcolm L. Jacobson said after a four-hour debate, during which a majority of 30 senators killed eight of 10 attempts to further restrict the bank in its bid for broad operating powers in Maryland.

The Senate ended the intense debate by giving preliminary approval to a measure that would allow Citicorp to open 20 branches in Maryland until 1988, after which Citicorp could establish an unlimited number of branches.

Two hours later, the Senate, with no further debate, quickly gave final approval to the bill on a 36-to-11 vote. The measure must still be approved by the House, which has already adopted a similar but less restrictive measure.

The Senate also unanimously gave final approval today a regional banking compact that would establish by 1987 an indefinite period of regional banking between Maryland, the District of Columbia and 14 other states, including Pennsylvania.

Under the terms of the compact, banks in the region could cross state lines to merge with or acquire Maryland banks; Citicorp, a bank holding company centered outside the region, would be barred from "leapfrogging" around the region to acquire other banks.

Action in the Senate on the Citicorp bill came less than five days before the close of the General Assembly and exactly four weeks after Hughes announced his agreement with Citicorp. Under that agreement the bank would establish a huge credit card service center employing at least 750 workers in the depressed Hagerstown area in Western Maryland.

In return, Citicorp sought to expand its now-restricted credit card operation in Baltimore County to reach a nearly equal footing with banks already doing business in the state.

Maryland bankers, long a potent force in Annapolis, have worked feverishly to kill the Citicorp agreement, concentrating their efforts on a bill nicknamed for the New York conglomerate that would allow it and any out-of-state institutions that guarantee the same investment Citicorp is promising to enjoy fuller privileges in Maryland.

Thus far, the local bankers' efforts have failed. This evening, during their most critical legislative test, their Senate allies never mustered more than 17 votes for any proposed restriction against Citicorp. By contrast, advocates of the so-called "Citicorp bill" had a core of 30 senators -- six more than needed -- to defeat all but the most minor limitations on the bank.

The most bitter arguments today arose in a two-hour discussion of an amendment proposed by Minority Leader John A. Cade (R-Anne Arundel), who sought the inclusion of language halting future expansion in Maryland by out-of-state banks if the Supreme Court nullifies the regional banking compacts, such as the one passed earlier today, that are sprouting up around the country.

Citicorp has challenged the concept of regional banking to the Supreme Court. Cade, noting the possible ramification of the case, argued that Maryland should have the authority to "freeze" banks such as Citicorp if the high court rules such compacts to be illegal.

Cade said his amendment, like other proposed restrictions, was crucial to striking "the fine balance between an open and free market -- and a regulated market."

Opponents of Citicorp saw the Cade amendment as their best chance to scuttle the bank's agreement with Hughes.

Citicorp allies said publicly what the opponents said privately: that passage of the Cade amendment could permanently cripple Citicorp in the state or make its Hagerstown venture so risky that it would force the bank to abandon the agreement.

Citicorp's allies trounced the opponents on that amendment with a 31-to-13 vote.