EU leaders have agreed to set up a single eurozone banking supervisor - a major step towards a banking union.
A legislative framework is to be in place by 1 January next year, with the body starting work later in 2013.
The European Central Bank-led mechanism will have the power to intervene in any bank within the eurozone.
The deal appears to be a compromise between France and Germany, who earlier disagreed over the timing and over the number of banks the ECB would oversee.
The timetable remains important, because only when the body is fully operational will the eurozone's rescue fund inject cash directly into ailing banks - so important for countries like Spain, says the BBC's Europe editor, Gavin Hewitt.
The deal was, at best, an uneasy compromise between the French and Germans and much wrangling lies ahead, our correspondent says.
France and the EU Commission wanted joint banking supervision, with the ECB in the lead role, to become operational in January 2013.
But German Chancellor Angela Merkel stressed that national budget discipline should be the priority.
Germany had been at odds with the European Commission over the scope of the proposed ECB supervision. Under the draft plan, all 6,000 banks in the 17-nation eurozone would be included - Germany wanted it limited to the biggest, "systemic" banks.
Previously, the German government has expressed a desire to retain supervisory responsibility within Germany over the country's Landesbanks - state-owned banks that play a key role in the economies and state finances of Germany's federal regions.
New ECB clout
Announcing the result of talks early on Wednesday, European Council President Herman Van Rompuy said the 27 EU member states had agreed to set up - by the end of this year - "a Single Supervisory Mechanism [SSM], to prevent banking risks and cross-border contagion from emerging".
"Once this is agreed, the SSM could probably be effectively operational in the course of 2013," he said.
EU Commission President Jose Manuel Barroso said that the ECB "will be able to intervene if needed in any bank in the euro area".
With new supervisory powers the ECB would be able to act early on to prevent a systemically dangerous accumulation of debt on a bank's balance sheets.
And once the legal framework is in place the new permanent rescue fund, the European Stability Mechanism (ESM), will be able to recapitalise struggling banks directly, without adding to a country's sovereign debt pile.
ECB supervision will not extend to the UK - Europe's main financial centre, but outside the euro.
However, the BBC's Business editor Robert Peston says there is now a serious risk that the UK will always be outvoted when decisions are taken on the regulation of banking and finance in the EU as a whole.
It is more than a theoretical possibility that the interests of the UK and City of London in shaping financial rules will be systematically ignored or overridden, he says.
Spanish breathing space
Both Germany and France appeared to be claiming victory in the negotiations.
The German chancellor said that the agreement was that "banks must be supervised in a differentiated way. That means that some will be direct... at the ECB level and others indirectly, via the national authorities."
She also said that ECB President Mario Draghi had told her it would be a matter of some months before the ECB was ready to take on its new role.
Mrs Merkel confirmed that the EU bailout funds would not be used to directly inject risk-absorbing capital into troubled eurozone banks until the new supervisory arrangements were in place.
A decision about how to recapitalise Spain's banks will be made in the next couple of weeks, according to Jean-Claude Juncker, who chairs the Eurogroup of finance ministers.
French President Francois Hollande said there had been no discussion of a possible request by the Spanish government for a bailout of its own finances.
But he said "the worst is behind us".
"We are on track to solve the problems that for too long have been paralysing the eurozone and made it vulnerable," Mr Hollande told a news conference.
Fraught with complications
EU leaders agreed that the ECB's new bank supervisory responsibilities would be strictly separated from its role in setting monetary policy.
The banking union plan is fraught with legal complications, as it would give more powers to the ECB and possibly weaken those of national regulators.
There is speculation that it could lead to treaty changes - something that has caused big headaches for the EU in the past.
The UK wants safeguards to protect the powers of the Bank of England.
Mr Barroso said the arrangement would be "as inclusive as legally possible for non-euro members to join if they want to".
Earlier, Mrs Merkel called for the EU to be given the power to veto member states' budgets. She said the EU economics commissioner should be given clear rights to intervene when national budgets violated the bloc's rules.