SAO PAULO, Oct 27 (Reuters) - Brazilian miner Vale SA's third-quarter profit fell by nearly a fifth but still beat analyst forecasts as financial gains largely offset a sharp decline in iron ore prices, it said on Thursday.

Vale, one of the world's largest iron ore miners, posted net income of $4.45 billion, or 98 cents a share, soundly beating the Refinitiv forecast of 57 cents.

The bottom line was boosted by a $2.35 billion financial gain related to unspecified foreign exchange rates, which largely masked weaker sales and rising costs.

Revenue fell 19.5% to $9.93 billion, lagging market expectations of $10.2 billion. Meanwhile, the cost of its products rose by 15.1% to $6.3 billion.

The decline in Vale's top and bottom lines comes as the price of iron ore, a key steel ingredient, is on course to end 2022 at its lowest level in recent years, reflecting subdued global demand.

In the three months ended Sept. 30, Vale realized an average price of $92.6 per tonne of iron ore, down from $127.2 per tonne in the same period of 2021.

Nickel prices, on the other hand, grew 19% from the year before, but were still 17.3% below the second-quarter's realized prices.

The mining giant recently announced a reorganization of its base metals business that it said could lead to a public listing.

In a statement, Vale's Chief Executive Eduardo Bartolomeo said the firm made progress in its plan to increase supply of "low carbon nickel and other critical minerals for the energy transition." ($1 = 5.3849 reais) (Reporting by Peter Frontini; Editing by Christian Plumb and Sam Holmes)