BRUSSELS — Working through the night in the face of pressure from the embattled euro zone countries Italy and Spain, European leaders agreed early Friday to use the Continent’s bailout funds to recapitalize struggling banks directly, according to the European Council president, Herman Van Rompuy.


Financial markets, which had expected little from the meeting, welcomed the announcement, suggesting it had exceeded expectations — though analysts cautioned that earlier summit agreements had prompted rallies that proved short-lived.


The decision, by leaders of the 17-nation euro zone, would allow help to banks without adding directly to the sovereign debt of countries, which has been a problem for Spain and potentially for Italy. Both countries have seen the interest rates on their debt rise to levels that would be unsustainable in the long term, and the Italian and Spanish prime ministers, Mario Monti and Mariano Rajoy, came here to push their colleagues to help.


Late Thursday, they said they would block all other agreements — on a 130 billion euro or $163 billlion growth pact for example — until their colleagues did something to help take the pressure off the third- and fourth-largest economies in the euro zone.


If their countries could not go to the markets to roll over their debt, Mr. Monti and Mr. Rajoy argued, there would be an existential threat to the euro in the short to medium term.


Spain is seeking 100 billion euros to recapitalize its banks, damaged by a property bubble.


Mr. Van Rompuy called the agreement a “breakthrough that banks can be recapitalized directly,” which represents a concession by northern European countries, including Germany.


The leaders agreed that the euro zone’s permanent bailout fund, the 500 billion euro European Stability Mechanism, due to come into being next month, could recapitalize banks directly once a banking supervisory body overseen by the European Central Bank has been set up. That should happen by the end of the year, he said.


The joint banking supervisory body is also a breakthrough, an effort to ensure the future health of the area’s banks, but details about that component of the agreement were scarce.


François Hollande, the French president, said Friday that the agreement offered a number ways to give troubled economies the rapid assistance that they had been seeking.


“It’s very important that we put into motion procedures for immediate action — that was something much hoped for,” he said. “Bank supervision for a recapitalization of the banks will take a bit more time, but this is a move in the right direction.”


“To have defined a vision for the economic and monetary union” was a fundamental step toward answering the question “what we do we want to do together,” Mr. Hollande said.


Graham Neilson, chief investment strategist at Cairn Capital, an asset management and investment company in London, noted that while the agreement represented some progress, some fundamental issues were not addressed.


“The burden of future risk is being shared more widely, meaning the chances of a euro zone breakup have been lowered for the short term,” he said. “But at the same time, the longer-term ante is higher for all involved and the root causes of the structural imbalances remain.”


The Euro Stoxx 50, a measure of European blue chips, was up 2.09 percent in late morning trading in Europe. National indexes were also up, most by more than 2 percent. Asian stock markets also rose.


The interest rate on 10-year Spanish bonds was at 6.572 percent, down 0.275 percentage points. The comparable Italian bond was at 5.963 percent, down 0.207 points.


The euro was at $1.2574, up from $1.2430 late Thursday in New York.


Mr. Van Rompuy said the euro zone would make more “flexible” use of the existing bailout funds for “well-behaving nations” in order “to reassure markets and to get again some stability around the sovereign bonds of our member states.” There would be unspecified conditions attached to this use of the bailout funds, he said, but it would not require a special adjustment or austerity program.