MADRID — Only a month after being lionized for staring down European officials and avoiding budgetary dictates from Brussels, Prime Minister Mariano Rajoy unveiled another package of unpopular austerity measures on Wednesday as the country’s miners staged a raucous and occasionally violent protest.

Madrid, the euro zone’s fourth-largest economy, is facing interest rates for its bonds that are unsustainable in the long run, forcing Mr. Rajoy to take many of the measures pressed on Europe’s insolvent countries — Greece, Portugal and Ireland — by international lenders.

“The circumstances have changed,” Mr. Rajoy said in offering the new plan, “and I have to adapt.”

His trump card throughout the crisis has been fear: deep concerns about the consequences of a full-scale bailout of Spain that could potentially throw the euro zone into an immediate crisis and a potential death spiral. So on Tuesday, European allies agreed to lend Mr. Rajoy billions to recapitalize Spanish banks and to give him until 2014 to meet deficit targets of 3 percent of gross domestic product.

As Spain’s problems have mounted, officials have chipped away at Mr. Rajoy’s independence, and this time there was apparently a quid pro quo, in the form of the new package of tax increases and spending cuts, including a three-point rise in the national sales tax, to 21 percent from 18 percent, breaking a previous pledge by Mr. Rajoy. The round of measures, the fourth from Mr. Rajoy in seven months, is devised to reduce Spain’s budget deficit by $80 billion over the next two and a half years.