It will be the first instalment of a bailout of up to 100bn euros, which was agreed in June reports The BBC.
The ministers will need to get approval from their own parliaments and hope to make the payment by the end of July.
The eurozone finance ministers also agreed to extend the 2013 deadline for Spain to cut its budget deficit to the EU limit of 3% by one year.
The yield on Spanish bonds rose sharply on Monday ahead of the meeting, with many fearing that little concrete action on Spanish banks would be reached.
“We are aiming at reaching a formal agreement in the second half of July, taking into account national parliamentary procedures, allowing for a first disbursement of 30bn euros by the end of the month to be mobilised as a contingency in case of urgent needs in the Spanish banking sector,” Eurogroup President Jean-Claude Juncker said.
“There will be specific conditions for specific banks, and the supervision of the financial sector overall will be strengthened,” he added.
The exact amount that Spain needs for the bailout of its banks may not be known until September.
Mr Juncker also said that Madrid should implement measures needed to bring its public finances into line with EU norms.
On Saturday, Spanish Prime Minister Mariano Rajoy announced that he would take further steps soon to cut the country’s public deficit.
In a news conference at the end of Monday’s marathon meeting, a number of appointments were also announced.
The ministers reappointed Mr Juncker as their chairman and picked German Klaus Regling to head the permanent bailout fund, the European Stability Mechanism, which is due to come into force this month.
The conclusions of the finance ministers from the 17 countries that use the euro will be submitted to a meeting of all 27 EU finance ministers later on Tuesday.
On Monday, the yield on Spanish 10-year bonds, which are taken as a strong indicator of the interest rate the government would have to pay to borrow money, had risen above 7%, while Italian bond yields had reached to 6.1%.
Yields above 7% are considered to be unsustainable in the long term