The importance of Saturday’s deal is to isolate the Sweden Democrats, who had said that they would use the proposed March elections as a referendum on immigration. The accord creates an accommodation among six parties that amounts to a deal on the budget that they were unable to reach earlier this month, causing the parliamentary defeat.

“This decision means that Sweden can be governed despite the difficult parliamentary situation,” Mr. Lofven said. The acting leader of the center-right Moderate Party, Anna Kinberg Batra, said that “it means that Sweden can be governed by the parties that have the biggest support among voters.”

The Sweden Democrats, who were gaining further support in opinion polls, condemned the deal as anti-democratic and said that they would seek an opportunity to force a no-confidence vote in the government, but expectations were that the other parties would support Mr. Lofven in such a vote.

The polls also indicated that a March vote would not break the deadlock in Parliament, with neither the center-left nor the center-right able to form a majority government, meaning that the Sweden Democrats would continue to hold the balance of power.

The arrangement is complicated, but it means that Mr. Lofven abandons his own government’s budget and follows the center-right’s budget, though he can make some changes in the spring. After that, the center-right parties, which form the Alliance bloc, pledged to abstain from voting against the government’s budgets in a deal that is supposed to last until 2022. The main parties also agreed to coordinate policy on pensions, defense and energy issues.