SYDNEY—BHP Billiton Ltd., the world’s No. 1 miner by market value, recorded its worst-ever annual loss as US$7.7 billion in charges exacerbated a deep slump in commodity prices.

Melbourne, Australia-based BHP reported a net loss of $6.39 billion for the 12 months through June, compared with a year-earlier net profit of $1.91 billion. Underlying profit, stripping out one-time charges, slumped 81% to $1.22 billion.

As recently as 2011, annual profits topped $20 billion.

The loss deepens the gloom in the global mining sector, which has responded to global economic uncertainty and low prices for commodities from copper to iron ore by closing mines, laying off workers and slashing returns for investors.

BHP’s earnings also took hits from problems not shared by many of its mining peers: a deadly disaster at an iron-ore mine in Brazil and weak oil and natural-gas markets. Those enormous charges were largely against the Brazilian venture and U.S. onshore energy assets—$2.2 billion and $4.9 billion, respectively. BHP’s petroleum business, intended to help it through bad times in metals markets, lost $7.72 billion after its write-downs.