ATHENS — Prime Minister George A. Papandreou and his chief rival agreed Sunday night to create a new unity government, under a new prime minister, that will move ahead with the country’s debt-relief deal with the European Union and then hold new elections. Mr. Papandreou agreed to resign once the details are completed on Monday.

The agreement appeared to break a political deadlock that had paralyzed Greece in the face of an acute financial crisis that threatened to infect other euro-zone nations, especially Italy. European leaders see the debt-relief deal struck with Greece on Oct. 26 as crucial to containing the crisis in Greece and insulating Italy, a much larger economy whose political leaders have also struggled to cut budgets and deal with heavy debt.

The agreement in Greece could not have come soon enough for its European partners, who have pressed the country hard to forge a broader political consensus behind the debt deal. But it was not clear whether the agreement would provide the certainty that skeptical investors are demanding to calm turbulent financial markets.

The debt deal requires that the Greek Parliament pass a new round of deeply unpopular austerity measures, including layoffs of government workers, in a climate of growing social unrest. It also calls for permanent foreign monitoring in Greece to ensure that it makes good on its pledges of structural changes to revitalize its economy, a requirement that many Greeks see as an affront to national sovereignty.