Aug 5 (Reuters) - U.S. rare earths miner MP Materials Corp posted a better-than-expected quarterly profit on Thursday on rising prices for the minerals used to make high-end electronics and weaponry.

Shares rose 5% to $38 in after-hours trading.

The company, which relies on China to process rare earths from its California mine, reported second-quarter profit of $27.2 million, or 15 cents per share, compared to a net loss of $62.5 million, or 92 cents per share, in the year-ago quarter when it was a private company.

Excluding one-time items, MP earned 17 cents per share. By that measure, analysts expected earnings of 13 cents per share, according to IBES data from Refinitiv.

Sales of rare earth oxides fell about 4% due in part to shipment timings, but that was offset by a 137% price increase.

Currently, MP lightly processes rare earths it extracts from California's Mountain Pass mine and ships the material to China https://www.reuters.com/article/us-usa-rareearths-insight-idUKKCN2241KF for separation into various rare earth metals because there are no U.S.-based options.

The U.S. government has funded the Las Vegas-based company in part to help bring processing back to the country, where the rare earths industry had its genesis in the mid-20th Century.

MP expects to be producing roughly 6,000 tonnes of the rare earth metals neodymium and praseodymium in California annually by 2023. (Reporting by Ernest Scheyder Editing by Chris Reese, Sonya Hepinstall and David Gregorio)