An earthquake with a magnitude of 6.3 shook western Iran on Sunday, the U.S. Geological Survey reported, and Iraqi state media said the tremor had been felt in Baghdad and other provinces.