(Writes through, adds details, quotes, context)
By Anastasia Lyrchikova and Polina Devitt
MOSCOW, Aug 22 (Reuters) - Russian coal and steel producer Mechel swung into a net profit in the second quarter from a loss in the same period of the previous year, and has obtained a loan to refinance its debt, the company said on Wednesday.
Mechel, which has been in talks with some of its lenders over the past couple of years, said that in July it raised a euro-denominated loan worth 64.7 billion roubles ($966 million) to refinance an earlier $1 billion pre-export financing agreement.
Its representative told Reuters that the new loan, due in 2022, was obtained from Russia's second largest lender VTB in a process that is "yet to be completed". The company had planned to fully restructure its debt portfolio by the end of 2018.
Mechel shares outperformed the market on Wednesday, rising 3.8 percent compared with a 0.2 percent increase in the benchmark stock market index MOEX. That made the company the second biggest gainer on the index.
The company, controlled by businessman Igor Zyuzin, on Wednesday reported a second-quarter net profit of 1.4 billion roubles ($20.9 million) after a loss of 8.9 billion roubles a year ago, when its bottom line had been hit by debt revaluation.
Mechel borrowed extensively during the commodities boom in the 2000s and went through a painful restructuring of most of its debt following the 2008 financial crisis, exacerbated by Russia's economic crisis in 2014.
As of the end of June, when its net debt excluding fines and penalties totalled 474.4 billion roubles ($7 billion), the portion of restructured debt was at 76 percent.
Its second-quarter revenue rose 14 percent year-on-year to 82.2 billion roubles, with earnings before interest, taxation, depreciation and amortisation (EBITDA) up 32 percent to 23.0 billion roubles, the company said in a statement.
Revenue was also up from the previous quarter due to higher prices for its products, even though in June the FIFA World Cup put a dampener on construction activity and overall demand, it said.
The company also reported a 6 percent decline in its first-half coal production to 9.7 million tonnes on Wednesday and told Reuters that it had downgraded its forecast for 2018 coal production to 21 million tonnes from 23.3 million tonnes. ($1 = 66.9725 roubles) (Reporting by Anastasia Lyrchikova and Polina Devitt; writing by Polina Nikolskaya and Polina Devitt; editing by Jan Harvey)