President Reagan, in a spirited budget struggle with Congress, closed the government yesterday, the first time a chief executive has ordered so massive a shutdown of federal operations.

But after Congress passed--and Reagan signed--a short-term funding bill, the administration said the government would be back in business today.

It was like a bad play that opens one day and closes the next--only in reverse.

The president began the day with his promised veto of the federal spending bill and gave sweeping orders to close down nonessential government offices, the Congress agreed to continue spending at current levels until Dec. 15, and the way was cleared for all federal employes to return to their jobs today.

The most histrionic of the almost annual crises over keeping the government in spending money sent thousands of nonessential workers home early, closed the Statue of Liberty, forced the secretary of transportation to consider using public transport instead of his chauffeur-driven limousine--and settled nothing.

The workers furloughed yesterday were theoretically not to be paid for their time away from work, but that pay probably will be restored based on the resolution of smaller shutdowns affecting a few departments in the past. Sen. Mark O. Hatfield (R-Ore.), chairman of the Senate Appropriations Committee, and other senators made clear on the Senate floor that pay would be restored this time, too.

The latest crisis passed without resolving the dispute over federal spending. It ended with an agreement between Reagan and the Congress to take their Thanksgiving holiday first and fight over the budget later.

Before reaching agreement, the president blamed congressional Democrats, and Democratic leaders fired verbal salvos back at Reagan.

The Democratic-controlled House, followed by the Republican-controlled Senate, then accepted the compromise Reagan had offered and extended federal spending at its current level until Dec. 15.

At 7:55 a.m., Reagan received the $428 billion emergency spending bill from Congress that he had promised to veto. He quickly kept his promise, leaving most of the bureaucracy without funds to carry on its work. The veto did not interfere with defense, other activities essential to protection of life and property or the mailing of Social Security and other benefit checks.

A few minutes later, Reagan took his message before the television cameras, declaring that he had been forced to choose between a "budget-busting" bill or the risk of interrupting government activities and services.

He chose to cast the first veto of his administration, Reagan said, because despite the "possibility of some temporary hardship" the United States would face "a far greater threat to all Americans" from "continuing the past budget-busting policies of big spending and big deficits."

With increasing regularity in recent years, Congress has failed to send appropriations bills to the president in time for action before deadlines that prohibit federal spending on many activities. But never before have all the agencies and departments been affected as they were when the deadline passed at midnight Friday, nor has a president ever moved so forcefully to order a shutdown.

By late afternoon, Congress, as eager to get out of town for the holidays as was the president, who had postponed his departure for his California ranch from Sunday night, opted for the deferral.

It was a day rich in symbolic warfare as Reagan played to the hilt his role as decisive commander facing a crisis.

Reagan and his advisers acknowledged that the fight that brought on yesterday's disruption was over $2.5 billion, a drop in the federal budget bucket. But a carefully sculpted part of the Reagan presidential image is that he does not back away from a confrontation.

Reagan opened an emergency Cabinet meeting shortly after 8 a.m. by saying: "There's no cash to meet the payroll.

"We're going to cut down, shut down and eliminate all nonessential government services," Reagan told the Cabinet, according to deputy press secretary Larry Speakes.

Reagan, who throughout his political career has argued in favor of smaller government, declared: "This is not business as usual. This is not theatrics. It's for real."

He then gave orders that nonessential government workers be sent home as early as possible.

Last night, before leaving for his Thanksgiving holiday, the president signed the revised funding legislation. "Of course," he said, "we now must come back and do the work all over again, in the Congress, on a bill that can be signed.

"But I am glad for this extension, so no one's holidays were disrupted," Reagan said.

No one could be sure yesterday whether the exercise in closing down and then reopening the bureaucracy would save money or increase the federal deficit.

Edwin Harper, the deputy director of the Office of Management and Budget, estimated that if 400,000 employes were furloughed without pay it would save the treasury $50 million a day. But, if past practice is followed, the employes will be given their pay retroactively and the shutdown will have been a costly loss of time.

At the Justice Department, instructions went out to U.S. attorneys around the nation to seek delays in on-going trials unless there was an overriding need not to. A spokesman said he doubted any trials ground to a halt yesterday, but that would have been likely if the shutdown had continued into today.

The State Department canceled its daily press briefing on the grounds that the briefing was not an essential service.

Speakes talked to a crowd of reporters who squeezed into his office, but he insisted that he was not giving a briefing and refused to move to the larger White House briefing room because then his remarks could have been considered a press briefing.

Vice President Bush canceled a trip to New York City. Federal officials attending the Republican Governors Conference in New Orleans were summoned back to Washington.

If you wanted to telephone the White House to tell Reagan whether you supported or opposed him in his move to shut down the government, you could not do it. The comment office was closed. All its staff had been sent home.

OMB sent home 173 of about 600 employes and, in this crisis over the budget, canceled a number of meetings on planning the 1983 budget that Reagan must send to Congress in January.

Reagan's $200,000 annual salary was not interrupted because the Constitution guarantees that it not be diminished during a president's term.

Speakes indicated that Reagan moved to shut down the government for a principle as well as for the dollars involved.

"The basic thrust is to make a point about getting the budget process under better control," Speakes said, insisting there is no contradiction between claiming two goals propelled Reagan into yesterday's fracas.

Reagan wants "to stop the practicies of belated budgeting by stopgap measures adopted in artificially created environments of last-minute crisis. The process itself is irresponsible," Speakes said.

This stand on principle overlooked that had the Congress sent Reagan the spending bill he sought, it still would have qualified as a stopgap measure because it would have been in the form of a continuing resolution, not an appropriation bill.

Democrats lambasted Reagan for manufacturing a confrontation.

"I suppose the president intended all along to use this for a confrontation with the Congress," House Majority Leader James C. Wright Jr. (D-Tex.) said. "Every member of the conference committee, House and Senate, Republican and Democrat, had the full expectation and was led to believe that the president would sign the bill."

House Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass.) said Reagan "knows less about the budget than any other president in my lifetime. He can't even carry on a conversation about the budget."

Underneath the rhetoric was a serious question about the role of Congress and the president in shaping the budget. From the White House standpoint, Speakes said, the president is not getting a "fair opportunity" to participate in the budget process because of the Congress' failure to send appropriations bills to the president on a timely basis.

Some congressional leaders argue that Reagan has taken over their role as well as exercising his own.

By noon, federal workers were walking away from their jobs amid gibes over who was deemed essential.

Michael Fitzwater, a deputy assistant treasury secretary estimated that one-third of the department's 125,000 employes were gone by 1 p.m. Fitzwater added that he is not essential and would be gone by the end of the day.

At the Transportation Department, 30,000 of the 50,000 workers were asked to go home, including the secretary's chauffeur, Lloyd Fletcher. When reporters asked Lewis whether his driver who brought him to the White House for the Cabinet meeting was essential, he replied: "I'm going to send him home." Asked how he would get around, Lewis said: "I may take the bus."

The Commerce Department furloughed all but about 10 percent of its 35,000 employes. "We're playing a serious game," said spokesman Mary Nimmo.

The Federal Communications Commission told 1,500 of its 1,942 headquarters employes to leave their offices by 2 p.m.

Each department head was told to decide who was essential and who was not.

At the White House, chief of staff James A. Baker III made the decisions. He cut his staff by 50 percent; presidential counselor Edwin Meese III's staff was cut by 25 percent. All of the domestic policy staff except its director, Martin Anderson, was sent home. Initially, national security advsier Richard V. Allen was told to keep everyone on hand. Later, he asked 10 employes to take the day off.

The Defense Department said that none of its 1 million military or civilian employes were affected by the government shutdown.