House Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass.) and Senate Majority Leader Howard H. Baker Jr. (R-Tenn.) neared agreement yesterday on a plan to defer a vote on new production of MX missiles until after the Nov. 6 elections as part of an overall defense spending compromise for next year.

Although no firm decisions were reached in a 30-minute session between the two leaders, aides indicated progress had been made and said the broad outlines of an accord could be nailed down this week after consultations with other lawmakers and the White House.

Such an agreement would remove the major obstacle to Congress' adjourning early next month. It could also lead to quick passage of defense authorization and appropriations bills, a congressional budget resolution for fiscal 1985 and several domestic appropriations bills that Senate Democrats are holding up to force a defense compromise.

An aide to O'Neill said it was "clear" from the meeting that an MX solution "at a minimum" would require a vote by both houses of Congress next year to allow the Pentagon to proceed with production of more of the controversial nuclear weapons.

The aide called such a formula "the basis for an agreement on the MX" and indicated it had the two leaders' tentative approval.

This appeared to be a major breakthrough because Senate Republicans had insisted that production of the missiles be allowed to proceed next year unless Congress voted to disapprove the go-ahead in legislation that could be vetoed. It would take a two-thirds vote of both houses to override a veto, although a majority vote of only one house could block new authorization legislation.

A Senate Republican leadership aide was more cautious, saying an agreement hinged on several major points that have not yet been resolved as well as further consultations on Capitol Hill and at the White House.

But the aide characterized Baker as "extremely optimistic" that an agreement could be worked out and said another Baker-O'Neill meeting was planned for today. The aide also indicated that the MX formula cited by the House aide was "the framework that they're talking about."

Reportedly still to be resolved in the MX dispute is whether to drop money for the new missiles from the pending defense bills or to include it but stipulate that it cannot be spent until Congress votes to go ahead with production.

Another issue involves whether to go ahead with components that require long lead-time for production. One source said the White House had been insisting on this as a condition for accepting the suggested compromise.

Also unresolved is the number of new missiles to be authorized. The Senate approved 21 new missiles, with no strings attached. The House approved 15 new missiles but blocked production until next April, when a new authorization vote would be required.

Neither the Senate nor House position, nor the proposed compromise, affects the first 21 MX missiles being produced under legislation that was passed last year.

In addition to details of the MX plan, Baker and O'Neill have yet to arrive at an overall figure for defense spending next year or to resolve several other weapons-related disputes, including testing of anti-satellite weapons in space.

But sources said they were close to a defense spending figure, "within a couple of billion dollars," according to one senator. In their respective budget plans, the House approved $285.7 billion for defense and the Senate $299 billion, a compromise with the White House, which had originally asked for $313 billion.

While the White House has been insisting on the Senate position, Republicans said yesterday that the administration was getting eager for a compromise because a stalemate would impose on the Pentagon stopgap funding at a low rate when the fiscal year starts Oct. 1.