PROBLEM TO BE SOLVED: To provide a Ni-based alloy that has excellent erosion resistance to hydrogen sulfide and hydrogen selenide and is suitable for a device component such as a reaction vessel and piping used in production of a compound semiconductor photovoltaic cell and that has also excellent workability, as well as a device component made of the Ni-based alloy.SOLUTION: A Ni-based alloy contains, by wt.%, Cr:more than 43% and 50% or less, Mo:0.1-2%, Fe:0.05-1%,,Mn:0.05-0.5%, Si:0.01-0.1%, V:0.001-0.08%, B:0.0001-0.01% and Mg:0.001-0.02%, and further contains Al:0.005-0.3% and Ti:0.0005-0.03% as required, and the balance is composed of Ni and inevitable impurities. The Ni-based alloy has excellent erosion resistance to hydrogen sulfide and hydrogen selenide.