BRUSSELS — Under intense pressure from Italy and Spain, whose borrowing costs have soared beyond the point of sustainability, the 17 countries that use the euro agreed Friday to lend European Union bailout funds directly to banks and governments, a step Germany had long resisted.

BRUSSELS — Under intense pressure from Italy and Spain, whose borrowing costs have soared beyond the point of sustainability, the 17 countries that use the euro agreed Friday to lend European Union bailout funds directly to banks and governments, a step Germany had long resisted.

The accord, which came after marathon talks, was hedged with conditions and linked to putting new institutions in place over the coming months, among them a single European supervisor for banks in the eurozone. But top European officials called it a breakthrough, and markets soared around the world in an initial vote of confidence.

Interest rates for Spain fell a half point to 6.34 percent, after topping 7 percent in recent days, and Italy's borrowing costs fell to 5.94 percent. Stock markets in Frankfurt, Paris, Madrid and Italy registered daily gains of 2 percent or more, and the euro also climbed in value against the dollar.

Stocks also soared in the U.S., with the Dow up nearly 278 points.

"We agreed on something new, which is a breakthrough," Herman van Rompuy, the Belgian president of the European Council, told reporters after the pre-dawn agreement was reached.

The new EU policy will allow the European Stability Mechanism, a new institution with functions similar to the International Monetary Fund, to inject capital directly into Spain's failing banks, instead of through the national government, as soon as the all-European bank regulator is in place.

It also will allow countries such as Italy that have carried out austerity and reform measures but still are facing high interest rates to lower those costs by receiving loans from the ESM, which replaces an interim institution called the European Financial Stability Fund.

Mario Monti, Italy's prime minister, and his Spanish counterpart, Mariano Rajoy, blocked the summit from completing any other business until accord was reached on the financing crisis.

"May I stress that Italy worked a lot and put a lot of pressure at the negotiating table for this result to be achieved," said Monti as he left the meeting, with a big smile. Rajoy, somewhat less ebullient, said the meeting "set out the correct path for confronting the crisis and marked out a road map."

German Chancellor Angela Merkel also portrayed the accord as a triumph for German demands for fiscal discipline and accountability.

With the currency-related issues out of the way, the leaders of all the 27 EU countries signed off on two other accords, including a single patent court, with headquarters in Paris, and a "growth and jobs" package.