The 5.1-magnitude earthquake was recorded in Longchang City in Sichuan Province, southwestern China, the China Earthquake Networks Centre said.