Treasury Secretary James A. Baker III announced Friday he is resigning to take over George Bush's presidential election campaign, telling President Reagan he wanted to help "ensure the survival of your legacy."

Reagan called Baker "a friend whom I will miss" and announced that he was nominating Wall Street investment banker Nicholas F. Brady to be Baker's successor at Treasury.Referring to months of speculation about Baker's move, Reagan began his statement to reporters by exclaiming: "Well, as Jim Baker would say, `It's finally a done deal.' "

Bush, who was absent from the White House briefing room where Reagan, Baker and Brady appeared, held a news conference a while later at his campaign headquarters a few blocks away.

With Baker at his side, Bush said, "When that convention nominates me, I become more the candidate, more the standard-bearer of this party, and less the vice president of the United States."

The vice president said he would carry out his constitutional responsibilities but said that "once I get that nomination, my job is to run, run hard, all-out for the presidency."

For his part, Reagan seemed pleased for Bush, even though Baker's departure marked the second Cabinet resignation in as many months.

"You've been a secret of our success. Now, Jim, go do it for George," the president said.

Baker said he had enjoyed working for Reagan but told the president that "it does seem to me that in seeking to advance your vice president's candidacy, I can best help ensure the survival of your legacy."

During his joint news conference with Bush, Baker told reporters, "I am going to do my dead-level best to achieve that goal that we have both shared for a long time - that goal that you announced for the first time in May of 1979 when you announced that you were a candidate for president of the United States."

Welcoming Brady to his team, Reagan said, "I cannot think of anyone more qualified" to succeed Baker in the Treasury post. "Welcome to what might just be the most active six months of our administration," he said.

Baker's resignation is effective Aug. 17, the night his old friend Bush will formally receive the Republican nomination for president at the party's convention in New Orleans. That's also the effective date for Baker to officially become Bush's campaign chairman.

Brady's appointment is subject to Senate confirmation, and Reagan expressed confidence he would win it easily.

Baker's resignation was the latest in a long string of changes in the Cabinet in the final months of Reagan's tenure in the White House. Attorney General Edwin Meese III will leave his post later this month and was feted at a White House party earlier Friday.

Brady, 58, is chairman of Dillon, Read & Co., a Wall Street investment house. He served as an appointed senator from New Jersey for eight months in 1982 following the Ab-scam conviction of Sen. Harrison Williams. He also chaired a presidential commission named to look into the stock market crash last October.

Like Baker, Brady is a close friend of Bush and is regarded as a likely candidate to remain in the Cabinet if the Republicans hold the White House.

Reagan heaped praise on Baker, saying, "If there ever was a Reaganite, you are it."

There was irony in that. Baker spent 1980 trying to help Bush win the Republican presidential nomination as his campaign manager. He was later named chief of staff for Reagan's first White House term and used his Texas savvy to help push historic tax and spending cuts through Congress.

Baker moved over to the Treasury Department in the early days of Reagan's second term and helped manage enactment of the tax overhaul legislation that cleared Congress in 1986.

Brady told Reagan he would be proud to serve in his Cabinet. "Your administration has brought to this country the longest sustained period of prosperity in recent years," he said.

Brady chaired a commission appointed by Reagan that investigated last October's stock market crash. The panel recommended that the Federal Reserve Board coordinate federal supervision of the securities industry, but a working group of administration officials later recommended steps far short of that.

Brady would be the third person to head the Treasury Department since Reagan came into office in January 1981. Baker and then-Treasury Secretary Donald T. Regan switched jobs at the start of Reagan's second term in 1985.

There had been some concern both in the administration and in the Bush campaign about the timing of Baker's departure, given the sensitivity of the investment markets to changes at Treasury's top command, and concern about keeping the economy on a stable footing.