NEW YORK (AP) _ Insurance heavyweight American International Group Inc. is buying SunAmerica Inc., a leader in financial products people use in preparing for their retirement, for about $18 billion in stock.

The agreement announced today would be the latest megadeal in the financial services industry which is consolidating rapidly as banks, insurers and securities firms try to expand rapidly their base of customers.

New York-based AIG is a leading global provider of commercial and industrial insurance. SunAmerica is a key player in providing annuities and other financial products popular with individuals saving for retirement.

SunAmerica will continue to be based in Los Angeles, operating as a separate company with existing management and retaining its name under AIG ownership.

The boards of the two companies have agreed to the deal, according to a statement. The deal is subject to approval by the shareholders of both companies as well as by regulators.

Eli Broad, SunAmerica's chairman and chief executive, has agreed to vote his shares in favor of the merger, and is expected to joing the AIG board along with Jay S. Wintrob, vice chairman of SunAmerica.

Mr. Broad's family controls about 10 percent of SunAmerica's stock.

M.R. Greenberg, AIG's chairman and chief executive, said the deal ``positions AIG in a major market where we have not been well represented'' and will enable AIG to introduce SunAmerica's retirement products in worldwide.

``There will be immediate financial benefits, but the real upside will come from our position as the dominant player in the worldwide retirement savings market in the years ahead,'' he said.