WASHINGTON — After five years of bitter clashes, Republican congressional leaders and President Obama on Monday night appeared to settle their last budget fight by reaching a tentative deal that would modestly increase spending over the next two years, cut some social programs, and raise the federal borrowing limit.

The accord, which must be approved by the House and the Senate, would avert a potentially cataclysmic default on the government’s debt and dispenses with perhaps the most divisive issue in the capital just before Speaker John A. Boehner is expected to turn over his gavel to Representative Paul D. Ryan of Wisconsin.

Shortly before midnight, House Republicans posted the text of the 144-page bill, which was labeled a “discussion draft” but appeared to reflect the tentative agreement as described by congressional aides throughout the day.

The agreement would raise spending by $80 billion over two years, not including a $32 billion increase included in an emergency war fund. Those increases would be offset by cuts in spending on Medicare and Social Security disability benefits, as well as savings or revenue from an array of other programs, including selling oil from the nation’s strategic petroleum reserves. The Medicare savings would come from cuts in payments to doctors and other health care providers.