* Opposition parties to help ensure Spanish aid approved
* Merkel faces dissent over liability of aid for Spanish banks
* Vote follows legal blow from Constitutional Court
BERLIN, July 18 (Reuters) - Chancellor Angela Merkel faces a test of authority within her centre-right coalition on Thursday when the lower house of parliament votes on Berlin's contribution to an up to 100 billion euro ($122 billion) aid package for Spanish banks.
The Bundestag is almost certain to approve the rescue since members of opposition parties will back the measures.
However, Merkel is fighting dissent from some of her own conservatives and her Free Democratic (FDP) coalition partners over fears that Spanish banks, rather than the Spanish state, may become liable for the aid.
A major rebellion within her own ranks would be an embarrassment for Merkel who only needs a simple majority to get the law through but would prefer not to rely on opposition votes for such an important piece of legislation.
"From the signals I am hearing, I feel optimistic," Merkel told a news conference with her Thai counterpart on Wednesday.
Just over a year before the next federal election, Merkel is riding high in opinion polls thanks largely to her tough stance towards heavily indebted states in the euro zone crisis.
Many Germans are angry and frustrated at being the single currency's paymaster and do not want their burden to increase further to underwrite what they see as profligate euro zone states.
Germans are already bearing the brunt of bailouts to Greece, Ireland and Portugal.
Merkel is also trapped between intense pressure from some EU partners to move more quickly to stem the crisis and limits set by German public opinion, parliament and the Constitutional Court which has ordered the government give lawmakers more say.
In the latest legal blow, the court this week said it would keep Europe waiting until early September as to whether Germany can ratify the European Stability Mechanism, the euro area's permanent bailout fund, and a fiscal pact on budget discipline.
Lawmakers' main objection to the up to package for Spain, of which Germany would guarantee nearly 30 percent, is focused on confusion over whether liability rests with the state or banks.
Critics of the bill insist national governments should be liable for emergency loans granted to banks because otherwise German taxpayers face greater risks.
Under the temporary European Financial Stability Facility rescue fund, the vehicle initially used for Spanish aid, the Spanish state will be liable, but this will change once the ESM can recapitalise banks directly, a move discussed in the euro zone now in conjunction with a pan-euro area banking supervisor.
FDP lawmaker Lars Lindemann, who opposed the ESM in a vote in June, said he would vote 'no' again on Thursday because he felt parliament had been rushed and also because Spanish banks' owners should carry more of the cost.
"If we in Germany have to maintain a balance between actions and liabilities then this should also apply to the owners of Spanish banks," he told Reuters.
Merkel said on Sunday it had not yet been decided if the EFSF and its permanent successor, the ESM, will be liable for aid to banks in future.
Finance Minister Wolfgang Schaeuble was more explicit on Wednesday. He told the Rheinische Post daily that any decision to recapitalise banks directly from the rescue fund could only happen once a central supervisory body was up and running.
Even then it would have to be unanimously agreed by euro zone states and approved by the Bundestag, he said.
"The impression that has arisen through unclear and irresponsible comments from some individuals that we are now deciding on direct aid to banks without state liability is simply absurd. It is completely unfounded," he told the paper.
Despite Merkel's professed optimism about the vote, she has acknowledged she faces a rebellion from within her own ranks on Thursday afternoon after a debate opened by Schaeuble at 1200 GMT.
She has tried to lower expectations, saying on Sunday she wasn't aiming to get the symbolically important so-called "chancellor majority" which would require the support of 311 of her coalition's 330 MPs in the 620-seat house.
In June, some 26 MPs from Merkel's coalition voted against a bill on the ESM, even more than the 17 coalition MPs who rebelled against the second Greek bailout package in February.