An earthquake of magnitude 5.1 struck the province of Kermanshah in western Iran on Sunday, Iranian state TV reported.