Congressional and White House negotiators yesterday came tantalizingly close to an agreement on a package of revenue increases and spending reductions to reduce the federal deficit for fiscal 1988 by about $30 billion, but failed to reach a final compromise.

"We made headway on everything . . . but we just didn't reach closure," said Sen. Pete V. Domenici (R-N.M.) as he and other negotiators emerged yesterday afternoon from a nearly six-hour session in the Senate side of the Capitol.

In their 13th day of meetings -- which began shortly after the Oct. 19 stock market collapse brought the Reagan administration to the budget bargaining table -- lawmakers and administration officials were only about $1 billion apart from a framework agreement on higher taxes and domestic and defense spending levels.

Congressional sources said an agreement could possibly have been concluded yesterday, but administration officials, including Defense Secretary-designate Frank C. Carlucci, suddenly upped the ante on defense. "They wanted more money on defense," said one person familiar with the talks. "There are still further discussions on priorities. We want more revenue; they want more social cuts."

There was a renewed sense of urgency at yesterday's budget talks -- both because there was a heightened expectation that an agreement would be reached and because the White House and Congress hope to agree on at least $23 billion in deficit-reduction measures for fiscal 1988 by Nov. 20. If agreement is not reached by that date, the revised Gramm-Rudman-Hollings budget law dictates across-the-board spending cuts of $23 billion equally apportioned between military and domestic programs -- with some major exceptions, such as Social Security benefits.

Because of the deadline set by the Gramm-Rudman-Hollings law revision approved this fall, many members of the congressional negotiating team said today that even if an agreement were reached this week, Congress would have to find a way to postpone the automatic cuts.

The budget negotiators are only searching for a broad agreement that will outline overall tax and spending targets. Implementation would take considerable time, as congressional committees translate the agreement into specific taxes and expenditure levels for federal programs.

Yesterday's session brought the administration and lawmakers from both parties closer to finding a middle ground between Republican and Democratic plans that were formally proposed over the past few days. Each would reduce the deficit about $30 billion. In general, Democrats are seeking higher taxes, lower defense spending and higher domestic spending than congressional Republicans and the Reagan administration.

"We just had it about worked out, then we started to get into specifics," said Rep. Trent Lott (R-Miss.), the House minority whip. Lott said the negotiations fell short of achieving the necessary reductions in domestic discretionary spending and in entitlement programs, such as Medicare, that automatically confer benefits to those who are eligible.

Because the negotiations have operated under general ground rules that spending reductions and new revenues must be equal, coming up short on the spending side meant that the revenue component was unbalanced, preventing agreement, Lott said.

The failure to reach agreement yesterday underscored the fundamentally different priorities of the Reagan White House and the Democratic-controlled 100th Congress, which have kept them at loggerheads on the budget since January.

As snow from a Veterans Day storm piled up outside and scores of reporters and aides milled about in an otherwise deserted Capitol, negotiators in the Senate's Lyndon B. Johnson Room struggled over relatively minor stretches of budgetary ground.

Much of the morning, for example, was spent trying to decide whether defense spending would be $285 billion or $286 billion. And considerable time was spent on the foreign affairs portion of the budget, currently about $14 billion out of a $1 trillion federal budget.

Early in the session, at the insistence of administration budget chief James C. Miller III, aides were banished from the room, forcing negotiators to come out frequently for guidance on numbers.