MADRID (AP) — For months, Spanish Prime Minister Mariano Rajoy and German Chancellor Angela Merkel have been at odds over how eurozone countries could defeat the 17-nation bloc's relentless financial crisis.

Rajoy balked at the indignity of having to ask for a bailout — and the conditions it entails — that many observers believe his ailing country needs. Merkel stood firm, saying any financial rescue would come with strings attached.

On Thursday, the two leaders appeared to set aside their differences at a friendly joint news conference in Madrid as part of a European push to end the crisis. The European Central Bank on the same day unveiled a new program to help eurozone nations borrow money at affordable rates.

"There are still lots of problems, lots of things to be fixed in Spain," said Jose Ignacio Torreblanca, who heads the Madrid office of the European Council on Foreign Relations. "But I think (leaders) have understood that this game of chicken that they were playing was going to be very costly for everybody because at some point you could lose control."

Rajoy refused to say whether his government would tap the ECB bond-buying program, which would come with strict policy conditions. But Rajoy did give a nod to Germany's demands for fiscal discipline. Spain "must control its public finances," he said.

Merkel, meanwhile, heaped praise on Spain's efforts so far to cure its ills by cutting spending and enacting economic reforms designed to pull it out of a double-dip recession and lower an unemployment rate that stands at almost 25 percent — the highest among countries using the shared currency.

On Thursday evening several hundred people gathered outside the European Union's headquarters in Madrid to protest what they said is Germany's meddling in Spain's economy and ratcheting up the pain for everyday Spaniards. Some carried banners reading, "No to a German Europe" and "Merkel No, a IV Reich No."

The protesters included Rafael Anibal, 29, an unemployed journalist who said he is leaving Spain for Israel next month. "I'm here because I'm against Angela Merkel and my own government. They are both taking advantage of the situation to get rid of the welfare state."

But, notably, Merkel said she did not travel to the Spanish capital to lay down the law. She insisted that the two did not discuss extra measures Spain would be required to take if the ECB were to start buying Spanish bonds.

Rajoy and Merkel "staged the whole thing in order to ease ... tensions publicly. They are very conscious of how critical the situation is and they each decided to back down a bit (toward) the other," Torreblanca said.

"I think they are very worried about the trends they see ... in the markets. They see things going wrong," he said. "This is probably the most important thing from today's visit. They wanted to back down and contain things. They realized there was little else to do."

Madrid's IBEX-35 stock index jumped 4.9 percent after the news conference and the ECB announcement. The rate Spain pays on its 10-year bonds dropped 0.39 percentage points to 6 percent, the lowest level in months and an indication of greater investor faith in the economy.

Spain's government has been pressing for months for the ECB to buy Spanish bonds, but has stressed that it shouldn't be forced to impose more austerity it says would choke growth and fuel social unrest.

Rajoy said the wave of tax hikes and spending cuts he has pushed through since January "are very difficult measures and difficult to explain, but in the situation that we're in, we have to do it."

Few analysts doubt Spain will end up requiring a financial lifeline to deal with its economic troubles.

"Spain is in a very delicate situation, and we do need a full bailout," said Robert Tornabell, finance professor at the ESADE Business School in Barcelona.

Nevertheless, the ECB and possibly the International Monetary Fund will keep a close watch on countries helped by the bond-buying program, to make sure they don't backslide on promises to cut their debt levels.

"Now the ball's in our court," said Jordi Fabregat, a financial management professor at ESADE, referring to the Spanish government.

Rajoy would say no more on the subject of more cuts. "When I have something new, I'll communicate it," he said.

Merkel said she and Rajoy discussed a separate bank rescue package aimed at propping up the country's lenders hurt by a property boom that went bust, and the deteriorating financial condition of Spanish regional governments that function much like U.S. states.

___

Hatton contributed from Lisbon, Portugal. Harold Heckle from Madrid and David Rising from Berlin also contributed to this report.