diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
index 44063ad..aa97891 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
@@ -7,7 +7,6 @@
 
 namespace Drupal\Core\Field\Plugin\Field\FieldType;
 
-use Drupal\Core\Config\Entity\ConfigEntityType;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityTypeInterface;
 use Drupal\Core\Entity\TypedData\EntityDataDefinition;
@@ -146,12 +145,27 @@ public function setValue($values, $notify = TRUE) {
       $this->set('entity', $values, $notify);
     }
     else {
-      // Make sure that the 'entity' property gets set as 'target_id'.
+      parent::setValue($values, FALSE);
+      // Support setting the field item with only one property, but make sure
+      // values stay in sync if only property is passed.
       if (isset($values['target_id']) && !isset($values['entity'])) {
-        $values['entity'] = $values['target_id'];
+        $this->onChange('target_id', FALSE);
+      }
+      elseif (!isset($values['target_id']) && isset($values['entity'])) {
+        $this->onChange('entity', FALSE);
+      }
+      elseif (isset($values['target_id']) && isset($values['entity'])) {
+        // If both properties are passed, verify the passed values match.
+        if ($this->get('entity')->getTargetIdentifier() != $values['target_id']) {
+          throw new \InvalidArgumentException('The target id and entity passed to the entity reference item do not match.');
+        }
+      }
+      // Notify the parent if necessary.
+      if ($notify && $this->parent) {
+        $this->parent->onChange($this->getName());
       }
-      parent::setValue($values, $notify);
     }
+
   }
 
   /**
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceItemTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceItemTest.php
index db91b59..c7fc90b 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceItemTest.php
+++ b/core/modules/entity_reference/src/Tests/EntityReferenceItemTest.php
@@ -105,10 +105,33 @@ public function testContentEntityReferenceItem() {
     ));
     $term2->save();
 
-    $entity->field_test_taxonomy_term->target_id = $term2->id();
+    // Test all the possible ways of assigning a value.
+    $entity->field_test_taxonomy_term->target_id = $term->id();
+    $this->assertEqual($entity->field_test_taxonomy_term->entity->id(), $term->id());
+    $this->assertEqual($entity->field_test_taxonomy_term->entity->getName(), $term->getName());
+
+    $entity->field_test_taxonomy_term = [['target_id' => $term2->id()]];
     $this->assertEqual($entity->field_test_taxonomy_term->entity->id(), $term2->id());
     $this->assertEqual($entity->field_test_taxonomy_term->entity->getName(), $term2->getName());
 
+    // Test value assignment via the computed 'entity' property.
+    $entity->field_test_taxonomy_term->entity = $term;
+    $this->assertEqual($entity->field_test_taxonomy_term->target_id, $term->id());
+    $this->assertEqual($entity->field_test_taxonomy_term->entity->getName(), $term->getName());
+
+    $entity->field_test_taxonomy_term = [['entity' => $term2]];
+    $this->assertEqual($entity->field_test_taxonomy_term->target_id, $term2->id());
+    $this->assertEqual($entity->field_test_taxonomy_term->entity->getName(), $term2->getName());
+
+    // Test assigning an invalid item throws an exception.
+    try {
+      $entity->field_test_taxonomy_term = ['target_id' => 'invalid', 'entity' => $term2];
+      $this->fail('Assigning an invalid item throws an exception.');
+    }
+    catch (\InvalidArgumentException $e) {
+      $this->pass('Assigning an invalid item throws an exception.');
+    }
+
     // Delete terms so we have nothing to reference and try again
     $term->delete();
     $term2->delete();
