Goldman Sachs said it agreed to sell part of its stake in Japan's Sanyo Electric Co Ltd into a planned tender offer by Panasonic Corp, locking in 59 billion yen ($648 million) in profit.

Panasonic, which vies with Sony Corp for the position as the world's largest consumer electronics maker, plans to take over Sanyo, pending approval from anti-monopoly regulators in the United States, China and Europe.

Goldman became a major shareholder of Sanyo when it, along with Daiwa Securities SMBC and Sumitomo Mitsui Banking Co, bailed out the world's largest rechargeable battery maker in 2006.

Of the 178.6 million preferred shares Goldman bought in Sanyo for 700 yen each, it is now set to sell 96.7 million shares to Panasonic, Goldman said in a statement.

Panasonic is offering 1,310 yen for each preferred share, or an 87 percent premium to Goldman's purchase price.

The U.S. bank also said it has converted the remaining 81.9 million preferred shares into 819 million common stock, representing a 13 percent stake in Sanyo.

(Reporting by Kiyoshi Takenaka; Editing by David Cowell)