(Adds details, analyst reaction)
ZURICH, July 31 (Reuters) - The Swiss National Bank reported a 11.96 billion Swiss franc ($12.12 billion) profit during its second quarter as gains from its massive dollar investments outweighed losses on its euro-denominated holdings.
The central bank made a 12.25 billion franc profit from its foreign currency investments, which have ballooned to 784 billion francs at the end of June, while its gold reserves chalked up a valuation loss of 708 million francs.
Making a profit is not a goal for the SNB, but has been a side effect of its massive currency purchases designed to weaken the franc, which the central bank continues to describe as "highly valued".
The SNB made a profit of 5.1 billion francs during the first half of 2018 after it posted a loss of 6.8 billion francs during the first quarter.
The bank's figures were swelled by 2 billion francs in dividends from its huge stock portfolio, with the SNB being one of the largest investors in U.S. companies like Facebook, Apple and Starbucks.
The SNB's equity portfolio increased in value by 1.8 billion francs during the first six months of the year.
The SNB has invested heavily in stocks as it sought a place to stash the billions in foreign currency it has bought with newly created Swiss francs as part of its long-running campaign to weaken the franc.
At present the SNB holds 21 percent of its investments in stocks and the rest in bonds.
The SNB's bond portfolio brought in 4.9 billion francs in interest payments during the first six months of 2018, although the holdings also lost 4.6 billion francs in value.
The SNB made a profit of 1 billion francs from its Swiss franc positions, which largely resulted from negative interest it charges on sight deposit account balances.
"The SNB's equity portfolio did very well, which counterbalanced the turbulence in the bond market," said Alessandro Bee, an economist at UBS.
"The SNB has also benefited from its U.S. exposure with U.S. equities doing better than in Europe and also from the appreciation of the U.S. dollar which increases the value of their holdings in the U.S.," he added.
"This shows how diversification of the SNB's massive investments really helps reduce risks."
$1 = 0.9871 Swiss francs Reporting by John Revill; Editing by Michael Shields