Gov. David A. Paterson and leaders of the Legislature have reached a deal to temporarily raise taxes on New York’s highest earners in order to close the state’s yawning budget deficit, lawmakers and officials involved in the talks said on Saturday.

The new plan, which would expire after three years, would represent the largest state income tax increase in recent history, significantly larger than the surcharges imposed from 2003 to 2005, when the state last faced a major recession.

The plan would raise $4 billion a year by creating two new tax brackets, the highest one affecting those who earn $500,000 or more. If approved by rank-and-file lawmakers in the Assembly and State Senate, the tax increases would be a major victory for unions and liberal advocacy groups and a signal of the new balance of power in Albany, where Democrats won control of both houses of the Legislature and the governor’s office in last year’s election.

Although the proposed tax has been called a “millionaires’ tax,” it would affect those with incomes starting at $300,000, who would be taxed at a rate of 7.85 percent. The highest bracket would carry a tax rate of 8.97 percent  the same as New Jersey’s current highest rate.