House and Senate negotiators early today reached tentative agreement on a "framework" for a fiscal 1987 budget, paving the way for possible congressional action on the measure before Congress recesses this week for the Fourth of July holiday.

The tenatative agreement followed nearly a month of intensive on-again, off-again talks as Congress increasingly fell behind deadlines set by the Gramm-Rudman-Hollings deficit-reduction law.

The final round of bargaining began at 11:30 a.m. yesterday and ended at 1:15 a.m. today. House Budget Committee Chairman William H. Gray III (D-Pa.) said that the four senior members of the House and Senate budget panels had reached a "framework that will perhaps put us on a road to a conference report," subject to review later this morning after some sleep.

Neither Gray nor Senate Budget Committee Chairman Pete V. Domenici (R-N.M.) offered details but said they anticipate that a favorable review of last night's work will lead to a full meeting of the conference at mid-day and actions by both houses before the start of the two-week recess.

Throughout the day, the bargainers had been divided over domestic spending as well as defense and taxes, although it was clear all along that their priorities would differ sharply from those of President Reagan, who had criticized both Senate and House versions of the fiscal blueprint for next year.

One key element in the closed-door talks was a Senate proposal for a reserve fund to finance additional spending for defense and domestic initiatives if taxes are raised to finance them.

Both the Senate and the House have voted to slash Reagan's $320 billion defense spending request for next year, with the Senate proposing $301 billion and the House $285 billion. Under the reserve proposal, as originally advanced by the Senate, defense spending would be $293 billion without new taxes, and $299 billion with them.

House bargainers balked at the reserve proposal, contending that major Democratic initiatives for trade-related jobs, health and education programs would be jeopardized if Reagan vetoed any tax-increase measures, as he has vowed to do.

One compromise under consideration yesterday would fuzz any reference to tax increases or specific domestic programs to be left in limbo under the reserve concept.

However, sources indicated the conferees had been in intense disagreement over such basic issues as Medicare, Medicaid and other broad categories of domestic spending. At one point, they were at odds over about $5 billion in domestic savings that senators were insisting be mandated rather than just assumed.

"The problem," said Sen. Lawton Chiles (Fla.), ranking Democrat on the Senate Budget Committee, "is money."

Gramm-Rudman-Hollings requires automatic, across-the-board spending cutbacks if Congress exceeds a $144 billion deficit target for fiscal 1987, based on estimates to be made Aug. 15.

Congress does not return from its Fourth of July recess until the week of July 14, leaving only a month for passage of a budget and accompanying deficit-reduction legislation before the deficit-estimate "snapshot" is taken.

As passed earlier this year, both House and Senate budgets met the $144 billion deficit target but required about $40 billion in spending cuts and tax increases in order to do so.

Moreover, since preliminary action was taken on the budgets, deficit estimates have grown by roughly $10 billion, possibly necessitating additional deficit reductions to stay under the ceiling.

By law, Congress was supposed to have passed the budget and made progress on appropriations and deficit-reduction reconciliation legislation by now.

Without such action, the Gramm-Rudman-Hollings law said Congress could not recess for the Fourth of July holiday.

However, the House quietly waived the provision last week, and both houses planned to recess today or Friday, with or without a budget.